Sure.

DEPARTMENT is a parent, PERSON is a child, cause PERSON has a foreign key matching DEPARTMENT's primary key.

Andrus


On Nov 30, 2005, at 6:41 PM, Legolas Woodland wrote:

Andrus Adamchik wrote:
One-to-many simply means that a table on to-many end has a foreign key matching primary key of to-one. Here is an example taken from Cayenne test cases run on Derby. DEPARTMENT - PERSON is one-to-many:


CREATE TABLE DEPARTMENT (DEPARTMENT_ID INTEGER NOT NULL, NAME VARCHAR (100) NOT NULL, PRIMARY KEY (DEPARTMENT_ID))

CREATE TABLE PERSON (DEPARTMENT_ID INTEGER, NAME VARCHAR (100) NOT NULL, PERSON_ID INTEGER NOT NULL, SALARY DOUBLE PRECISION, PRIMARY KEY (PERSON_ID))

ALTER TABLE PERSON ADD FOREIGN KEY (DEPARTMENT_ID) REFERENCES DEPARTMENT (DEPARTMENT_ID)


Cheers,
Andrus Adamchik


On Nov 29, 2005, at 6:42 PM, Legolas Woodland wrote:

hi
Thank you for reading my post.
how i can make a one-to-many related tables ?
can you pleas give me a sample :)






Thank you for reply
I read in a book that in a Master details relation there are two tables , one of them is supplier table (is it the foreign key table or Primary key table ?)
and one Client table.
I also seen that people who know the relation , call them Parent , child tables. but i can not understand which table is client /child and which one is supplier / parent (if I'm true about parent child equality with supplier client.)


Reply via email to