On Fri, Sep 05, 2008 at 09:31:43PM +0200, Andreas Ntaflos wrote:
> In the Room table the primary key is a combination of two attributes. How 
> could I auto-increment the roomID? "roomID INTEGER AUTOINCREMENT" is 
> syntactically incorrect and the AUTOINCREMENT keyword seems to cannot appear 
> anywhere else.
> 
> What is the SQLite-way to auto-increment when the AUTOINCREMENT keyword is 
> not 
> available? 

I think you should make the roomID the primary key, and autoincrement,
then create a UNIQUE INDEX for the Room table on the roomID and
buildingID columns.

Finally, you already know you need to use triggers to enforce the
foreign key constraint.

What does it matter, then, that you can't declare those two columns of
the Room table as PRIMARY KEY and get autoincrement for roomID?  You can
get autoincrement behavior and primary key behavior as described above.

Nico
-- 
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to