I fail to see what any of this has to do with sqlite.  I thought this was a
mailing list for sqlite?  Seeing queries (no pun intended) on sql
statements is very subjective, especially with the limited data provided by
the original poster.
Everyone will give helpful advice, but it won't stop there, and as soon as
the original poster has another query (no pun intended) which would result
in a schema change, this would have to be explained, etc.

A specific group on SQL is required.

Just my thoughts...


Chris

On Thu, Jun 16, 2016 at 10:14 PM, Simon Slavin <slav...@bigfraud.org> wrote:

>
> On 16 Jun 2016, at 9:53pm, Drago, William @ CSG - NARDA-MITEQ
> <william.dr...@l-3com.com> wrote:
>
> > Should that function insert its results into a table that looks like the
> one below, or is there a better way?
> >
> > CREATE TABLE Groups (
> > ID INTEGER PRIMARY KEY,
> > AppleID1 INTEGER
> > AppleID2 INTEGER
> > AppleID3 INTEGER
> > AppleID4 INTEGER
> > );
>
> You would definitely want each of the four AppleIDs to have a FOREIGN KEY
> reference to the Apple table.
>
> An alternative to your Groups table would be a Membership table:
>
> CREATE TABLE Members (
> AppleID INTEGER,
> GroupID INTEGER,
> FOREIGN KEY (AppleID) REFERENCES Apples(ID)
> );
>
> It is the responsibility of your software to ensure that every GroupID
> appears exactly four times in Members.
>
> This would allow you to create another table, Groups, which stored things
> like the group's colour and total weight.  And this should be a foreign key
> reference for the Members table too.
>
> Simon.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to