Re: [sqlite] Foreign keys - one to one, one to many relationship

2017-10-14 Thread Wolfgang Enzinger
Am Sat, 14 Oct 2017 13:01:59 -0400 schrieb Richard Damon: > you could create a record in the other table without a corresponding > record in the blob table, but that is sort of needed to avoid chicken > and egg issues with creating new records (not sure when foreign key > requirements are teste

Re: [sqlite] Foreign keys - one to one, one to many relationship

2017-10-14 Thread Keith Medcalf
On Saturday, 14 October, 2017 04:37, Richard Damon , wrote: >One way to make them build one to at-most-one relationships is too >add a unique index on the foreign key, then it can only occur once. >A True one-one relationship by the normailization rules says that >they should all be in the same

Re: [sqlite] Foreign keys - one to one, one to many relationship

2017-10-14 Thread Richard Damon
Yes, sometime for performance reasons you need to break the rules of normalization. I did think that if the blob was at the end of the record, sqlite wouldn't read that part of the record unless asked to (so you aren't gaining that much with the separate table). If the second table is just t

Re: [sqlite] Foreign keys - one to one, one to many relationship

2017-10-14 Thread Stephen Chrzanowski
In this case, rules can be made to be broken. In the case of larger blobs, I push those out to a different table, and enforce (Through my software, not a unique constraint as mentioned) the one-to-one relationship. There is no reason to keep the blob on a record that is queried constantly. On Sa

Re: [sqlite] Foreign keys - one to one, one to many relationship

2017-10-14 Thread Richard Damon
On 10/14/17 5:35 AM, Simon Slavin wrote: On 14 Oct 2017, at 10:30am, Csányi Pál wrote: With which constraints can one create a foreign key to first: get one to one relationship, and second: one to many relationship? Foreign keys always implement a one-to-many relationship. You could enforce

Re: [sqlite] Foreign keys - one to one, one to many relationship

2017-10-14 Thread Simon Slavin
On 14 Oct 2017, at 10:30am, Csányi Pál wrote: > With which constraints can one create a foreign key to > first: get one to one relationship, and > second: one to many relationship? Foreign keys always implement a one-to-many relationship. You could enforce a one-to-one relationship by using o

[sqlite] Foreign keys - one to one, one to many relationship

2017-10-14 Thread Csányi Pál
Hi, on Gentoo linux I have installed sqlite3 version 3.19.3. With which constraints can one create a foreign key to first: get one to one relationship, and second: one to many relationship? -- Best, Pali ___ sqlite-users mailing list sqlite-users@mail