SQLite: Several foreign keys lazarus / 16-Databases ---------------------------------------------------------------------- vice · 2008-10-13 14:09 If I want to create a simple master/detail relationship of one-to- many, it is easy: Tables and fields: Contact: Code, Name <-- Master table Phone: Number, Contact (Contact is a foreign key reference to the primary key column in the Contact table) <-- Detail table Contact TDataSource properties:  - DataSet: ContactDataset  - Name: ContactDataSource Contact TSqlite3Dataset properties:  - Name: ContactDataset  - TableName: Contact Phone TDataSource properties:  - DataSet: PhoneDataset  - Name: PhoneDataSource Contact TSqlite3Dataset properties:  - Name: PhoneDataset  - TableName: Phone  - IndexFieldNames: Contact  - MasterFields: Code  - MasterSource: ContactDataSource But, if I want to create a master/detail relationship of one-to-many with several foreign keys, how I do it? For example I want to create this relationship: Contact: Code, Name <-- Master table Company: Code, Name <-- Master table Phone: Number, Contact, Company (Contact and Company are foreigns keys) <-- Detail table How I do it? Best regards.