Re: [sqlite] PK References One of Two Other Tables

2015-01-11 Thread Keith Medcalf
On Sunday, 11 January, 2015 11:22, Rich Shepard said: > Items to be raffled can be donated or purchased. The Donations and >Purchases tables each have the item ID as their PK. > The Raffles table should have the PK as either the Donations or the >Purchases item ID. How do I write the DDL cr

Re: [sqlite] PK References One of Two Other Tables

2015-01-11 Thread Rich Shepard
On Sun, 11 Jan 2015, Simon Slavin wrote: You can't do the latter. Foreign keys can reference only one table. You could create yet another table, which just supplies primary keys, but it would seem that this would just duplicate a function of your 'items' table. Simon, That's what I though

Re: [sqlite] PK References One of Two Other Tables

2015-01-11 Thread John McKown
On Sun, Jan 11, 2015 at 12:21 PM, Rich Shepard wrote: > Items to be raffled can be donated or purchased. The Donations and > Purchases tables each have the item ID as their PK. > > The Raffles table should have the PK as either the Donations or the > Purchases item ID. How do I write the DDL

Re: [sqlite] PK References One of Two Other Tables

2015-01-11 Thread Simon Slavin
On 11 Jan 2015, at 6:21pm, Rich Shepard wrote: > I've only had a > foreign key reference one specific table, not either of two tables You can't do the latter. Foreign keys can reference only one table. You could create yet another table, which just supplies primary keys, but it would seem t

[sqlite] PK References One of Two Other Tables

2015-01-11 Thread Rich Shepard
Items to be raffled can be donated or purchased. The Donations and Purchases tables each have the item ID as their PK. The Raffles table should have the PK as either the Donations or the Purchases item ID. How do I write the DDL creating the Raffles table so that the PK is either a donated or