Home » SQL & PL/SQL » SQL & PL/SQL » Data model design
Data model design [message #224505] Wed, 14 March 2007 08:10 Go to next message
Messages: 202
Registered: April 2006
Senior Member
I have two entities one entity namely entity_1 and entity_2,
entity_1 has one to many relation to entity_2.

I should also consider that there cannot be same pair of entity_1 and entity_2 i mean different combination .

I am confused in desinging datamodel
should I have the relation with a foreign key in entity_2 table or
create a new table with two PK entity_1 and entity_2.

For example

table: entity_1
columns : entity_1_id , name

with entity_2
I am confused
table: entity_2
columns : entity_2_1d , name , enitity_1_id FK
table: entity_2
columns : entity_2_1d , name
table entity_join
columns entity_1(FK) , entity_2 (FK)
Re: Data model design [message #224530 is a reply to message #224505] Wed, 14 March 2007 10:06 Go to previous message
Messages: 7062
Registered: December 2001
Senior Member
Why don't you add a unique key constraint on entity_2(entity_2_1d, entity_1_id)?

Previous Topic: Master Details Trigger problem in 10g XE App Express
Next Topic: Read SYS_REFCURSOR using DBMS_SQL
Goto Forum:

Current Time: Wed Oct 26 16:35:49 CDT 2016

Total time taken to generate the page: 0.10585 seconds