Re: [sqlite] FOREING KEY constraint

2017-07-03 Thread Paul Sanderson
> > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] > > On Behalf Of Clemens Ladisch > > Sent: Monday, 3 July, 2017 08:00 > > To: sqlite-users@mailinglists.sqlite.org > > Subject: Re: [sqlite] FOREING KEY constraint > > > > J. King wrote

Re: [sqlite] FOREING KEY constraint

2017-07-03 Thread Keith Medcalf
Ladisch > Sent: Monday, 3 July, 2017 08:00 > To: sqlite-users@mailinglists.sqlite.org > Subject: Re: [sqlite] FOREING KEY constraint > > J. King wrote: > > The sqlite_master table should have this information. > > > > SELECT count() FROM sqlite_master WHERE

Re: [sqlite] FOREING KEY constraint

2017-07-03 Thread Keith Medcalf
qlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] > On Behalf Of J. King > Sent: Monday, 3 July, 2017 07:51 > To: SQLite mailing list > Subject: Re: [sqlite] FOREING KEY constraint > > The sqlite_master table should have this information. > > SELECT count

Re: [sqlite] FOREING KEY constraint

2017-07-03 Thread Clemens Ladisch
J. King wrote: > The sqlite_master table should have this information. > > SELECT count() FROM sqlite_master WHERE name IS your_constraint_name AND > tbl_name IS your_table_name; Constraints do not have separate entries in the sqlite_master table. And there is no other mechanism to get this infor

Re: [sqlite] FOREING KEY constraint

2017-07-03 Thread J. King
Thank you. > >> >> -- >> ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı >> >>> -Original Message- >>> From: sqlite-users >[mailto:sqlite-users-boun...@mailinglists.sqlite.org] >>> On Behalf Of Simon Slavin >

Re: [sqlite] FOREING KEY constraint

2017-07-03 Thread Igor Korot
day, 3 July, 2017 04:49 >> To: SQLite mailing list >> Subject: Re: [sqlite] FOREING KEY constraint >> >> >> >> On 3 Jul 2017, at 4:37am, Keith Medcalf wrote: >> >> > What do you mean "check for uniqueness? >> >> If you give two

Re: [sqlite] FOREING KEY constraint

2017-07-03 Thread Keith Medcalf
-users-boun...@mailinglists.sqlite.org] > On Behalf Of Simon Slavin > Sent: Monday, 3 July, 2017 04:49 > To: SQLite mailing list > Subject: Re: [sqlite] FOREING KEY constraint > > > > On 3 Jul 2017, at 4:37am, Keith Medcalf wrote: > > > What do you mean "check for uniquenes

Re: [sqlite] FOREING KEY constraint

2017-07-03 Thread Simon Slavin
On 3 Jul 2017, at 4:37am, Keith Medcalf wrote: > What do you mean "check for uniqueness? If you give two constraints the same name, does SQLite A) Ignore the problem B) Reject the second one complaining "duplicate name" C) Replace the first one with the second Simon.

Re: [sqlite] FOREING KEY constraint

2017-07-02 Thread Keith Medcalf
See https://sqlite.org/lang_createtable.html -- ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı > -Original Message- > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] > On Behalf Of Igor Korot > Sent: Sunday, 2 July, 2017 21:12 > To: Discussion of SQLite Dat

Re: [sqlite] FOREING KEY constraint

2017-07-02 Thread Keith Medcalf
Yes. CREATE TABLE Parent ( id INTEGER PRIMARY KEY, data TEXT COLLATE NOCASE, CONSTRAINT unique_data UNIQUE (data) ); CREATE TABLE Child ( id INTEGER PRIMARY KEY, parent INTEGER CONSTRAINT child_to_parent REFERENCES Parent(id) ); or CREATE TABLE Child ( id INTEGER PRIMARY KEY, par