Re: [sqlite] Error in documentation for FOREIGN KEY ?
On 14 Mar 2010, at 11:13pm, Kees Nuyt wrote: > Well, it is consistent, when you take > http://www.sqlite.org/syntaxdiagrams.html#table-constraint > into account. > > CREATE TABLE is the only statement where references > constraints can be defined. Have a look at > http://www.sqlite.org/lang_createtable.html > > A column definition can contain a foreign-key-clause, which > is simply a REFERENCES column-constraint. Got it. Thanks to Kees and Jay. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Error in documentation for FOREIGN KEY ?
On Sun, 14 Mar 2010 22:04:18 +, Simon Slavinwrote: > I was trying to work out if I could add a FOREIGN KEY to a table after > it is originally created, using the ALTER TABLE command. I think there's an > error on > >http://www.sqlite.org/syntaxdiagrams.html > > I cannot find anything on that page that includes the actual words 'FOREIGN > KEY'. The section > >http://www.sqlite.org/syntaxdiagrams.html#foreign-key-clause > > starts with the word 'REFERENCES'. I traced up and down the hierarchy > but I couldn't find 'FOREIGN KEY'. This is not consistent with the > description of creating FK constraints as described in > >http://www.sqlite.org/foreignkeys.html Well, it is consistent, when you take http://www.sqlite.org/syntaxdiagrams.html#table-constraint into account. CREATE TABLE is the only statement where references constraints can be defined. Have a look at http://www.sqlite.org/lang_createtable.html A column definition can contain a foreign-key-clause, which is simply a REFERENCES column-constraint. In a table-constraint (defined after all column definitions) a REFERENCES constraint is introduced by the FOREIGN KEY keyword. The difference between the two is that a table constraint can (but doesn't have to) use composite keys, consisting of more than one column. >Simon. -- ( Kees Nuyt ) c[_] ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Error in documentation for FOREIGN KEY ?
On Sun, Mar 14, 2010 at 10:04:18PM +, Simon Slavin scratched on the wall: > http://www.sqlite.org/syntaxdiagrams.html > > I cannot find anything on that page that includes the actual > words 'FOREIGN KEY'. http://www.sqlite.org/syntaxdiagrams.html#table-constraint For a column constraint, the FK phrase starts with "REFERENCES...". For a table constraint, the FK phrase starts with "FOREIGN KEY... REFERENCES...". > The section > > http://www.sqlite.org/syntaxdiagrams.html#foreign-key-clause > > starts with the word 'REFERENCES'. I traced up and down the hierarchy > but I couldn't find 'FOREIGN KEY'. If you follow both "Used by" links, and find the reference to the child foreign-key-clause, it is pretty obvious. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Our opponent is an alien starship packed with atomic bombs. We have a protractor." "I'll go home and see if I can scrounge up a ruler and a piece of string." --from Anathem by Neal Stephenson ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users