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: Thu Aug 17 20:29:40 CDT 2017

Total time taken to generate the page: 0.32517 seconds