Subject RE: [firebird-support] One To Many Relationship!??
Author Clay Shannon
Fernando,

<< can anyone help me!??
i'm using firebird 1.5 and delphi...>>

Very briefly, a 1:N relationship is brought about by having a table with a
primary key that is stored as a foreign key in another table, such as

ParentTable
ID Integer primary key
FirstName VarChar
MiddleName VarChar
LastName VarChar

ChildTable
ID: Integer; primary key
FKID: Integer; foreign key (must be one of the values in ParentTable.ID)
FirstName VarChar
MiddleName VarChar
LastName VarChar

Example:

ParentTable may have a record with the values:
1, 'Blackbird', 'Crow', 'Raven'

And ChildTable has records with values:
1, 1, 'Kelvin', 'Caleb', 'Shannon'
2, 1, 'Morgan', 'Tell', 'Shannon'

Both records in the child table refer to record 1 in the parent table as
ithe child's parent (Blackbird Crow Raven is the parent of both Kelvin and
Morgan Shannon).

This, of course, is a very simple example. See Helen Borrie's book "The
Firebird Book" for all the nitty-gritty.

Clay Shannon,
Dimension 4 Software