Click here to Skip to main content
15,894,540 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using an Oracle database. The schema has four tables:

Table 1: worker (name , id , sex , salary , specialty )
Table 2: customer (name , id , bill , date of visit)
Table 3: service (servise id , type)
Table 4: order (orderNo , worker id , worker name , serviceID , date , custemorID)

I think orderNO is the PK and workerNAME and workerID are the composite PKs. Both are FKs. :confused:


My question: In table 4, which one of the attributes is the composite PK?
Posted
Updated 30-Dec-10 5:08am
v2
Comments
Slacker007 30-Dec-10 11:09am    
Reformatted and corrected spelling and grammar.

I seems your question little bit generic.

you asked Which one of the attributes is the composite PK ? Rather it should be Which one of the attributes should be the composite PK.

Now lets move on to your answer.

In Table 4 you already kept OrderNo as primary key and I think it's correct PK. Now why you want to make another composite PK ?

Composite PK is only use when one key is not enough to be a primary key.

If OrderNo is PK then I don't think of another Composite PK.

Further clarification on the question can give us little more understanding about.
 
Share this answer
 
Comments
Manfred Rudolf Bihy 30-Dec-10 13:44pm    
Agreed! +5
It really depends on the semantic of table Order. If it must be possible that this table contains rows that have the same entry in column OrderNo it can't be the sole PK and other columns must be included (compound PK).
I wouldn't be sure how to answer OP, as he didn't make it clear if he needs advice on the design of the DB. Without knowledge of what table Order stands for, I deem it impossible to find a conclusive answer.
ok
one question more

so there is no composite PK in any table.

now in ER digram I put under attribute (OrderNo) Fragmented line like -----

what is the meaning of this line (------)? >> in ERD

and If I make the OrderNo PK, is it affects when I create the tables in the oracle ??
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900