Mark Wyszomierski wrote:
Hi all,
Does sqlite allow multiple keys? When I created a table I did:
CREATE TABLE test (name, address, fav_color, primary key(name, address))
Is that valid? I would like to not have any duplicate name + address
entries. There
was no error reported but later I tried modifying the table in SQLite
Database Browser
and it complained that the table has multiple primary fields.
Thanks,
Mark
Mark,
Yes, that is valid SQL.
The error message means that you are trying to insert or update a row so
that its primary key (the combination of name and address) is the same
as some other row that already exists in the table. SQL requires that
the primary key of each row be unique.
HTH
Dennis Cote