Hi,
I have a table as follows:
CREATE TABLE t (
id INTEGER NOT NULL,
a VARCHAR NOT NULL COLLATE 'nocase',
b VARCHAR COLLATE 'nocase',
c VARCHAR CHECK (c IN ('foo', 'bar', NULL)) COLLATE 'nocase',
PRIMARY KEY (id)
);
How does one elegantly construct an index or constraint such that for any
row, column a may appear twice with column c having a value of 'foo' and
'bar', unless this value for column a appears with a null value in column c
where no other rows may now exist for that value of column a.
id a b c
-- --- --- ---
1 a b foo
2 a b bar
(no more rows with col a having a value of 'a'.
id a b c
-- --- --- ---
1 a b NULL
2 a b bar <- not allowed.
Thanks,
jlc
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users