I have a need to create a unique bi-directional relationship.

You can think of it as pairings of people who eat dinner together.



create table t(i int, j int);

insert into t(1,2);

insert into t(2,1); << should give an error because the pairing of 1-2 already 
exists.

insert into t(3,2); << OK

insert into t(3,1); << OK

insert into t(1,3); << should be error



You can't guarantee that one column is less than the other so there's no win 
there.



Speed is of the utmost concern here so fast is really important (how many ways 
can I say that???).



Is there anything clever here that can be done with indexes or such?





Michael D. Black

Senior Scientist

NG Information Systems

Advanced Analytics Directorate


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to