Subject Re: [ib-support] Re: going beyond FOREIGN KEY ... REFERENCES
Author Pete Clark
In message <00be01c2e68c$b4a4e2f0$0d02a8c0@...>, Arno Brinkman
<firebird@...> writes
>> >What you want to do can perfectly be done with foreign keys
>> mmm...
>Yes !
>> >you add a STAR table above your SYSTEM table, like:
>> could you please expand on this ?
>> I am afraid I didn't understand.
>> We start with this database:
>> create table Stars (
>> Star_ID integer not null,
>> System_ID integer,
>> primary key (Star_ID)
>> )
>> create table Systems (
>> System_ID integer not null,
>> Planet_ID integer not null,
>> primary key (System_ID,Planet_ID)
>> )
>> Are you suggesting to insert a 3th table btw Stars and Systems ?
>> Please write the code of the new database.
>A star can only be inside 1 solar-system right ?
>Isn't your system 1-1 with a star ?

I understand it differently - I believe that the system table should
really be called a planets table, and there is a n-Planets to 1-Star

It's the name of table, systems, which seems to be causing confusion.
There are a number of stars in a star system. But you would not file a
planet in that section. Each star has a planet system, and there is a
Planet_ID in the systems table, so I assume that the system refers to
the planet system, and so should be called Planets...

See, all that Star Trek wasn't completely wasted!

>Arno Brinkman

Pete Clark

No more terrorism - Arabic, American, or British