SQLite unique column based on foreign key -
this question has answer here:
i have table this:
create table a( _id integer primary key, name integer, message integer unique );
message column must unique when name columns same. how can achieve that?
example:
insert a(name, message) values (1, 5)
this must throw error:
insert a(name, message) values (1, 5)
this must work:
insert a(name, message) values (2, 5) insert a(name, message) values (1, 6)
thanks in advance.
you can set column unique click icon unique in tables list
alter table table_name add constraint constr_id unique (user_id, game_id, date, time)
Comments
Post a Comment