Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in database
I have 4 table4

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)


in table 4 i have PK "orderNo" , FK "workerID" , and FK "workerNAME"

are (workerId and workerName) Composite PK ??

or composite FK??

and how can create it in oracle?

if the PK is "orderOn"
Posted
Comments
Sandeep Mewara 3-Jan-11 3:57am    
Your question is not quite clear. What are you asking? Are you looking for table design? scripts? suggesting soemthing? Asking?

1 solution

I know you've asked this question again by providing some little clarity with your question. That isn't a good practice, Either update previous one we will then also get notification that you've asked question here.

I think you have some misunderstanding about PK,FC,CK and probably in Database design too, for that refer database normalization[^] for getting better understanding for yourself for some of your question. Like,

if you're including workerid in Order table then there's no need to include worker name there as you can get it easily by Join in query.

second, you've asked are (workerId and workerName) Composite PK ??, If worker id is a different for every worker then workerid can itself identify record uniquely then why are you adding another one column to make it CK ?

I've told you in previous question also that CK is needed when one key is not enough to identify record uniquely.
 
Share this answer
 
Comments
thatraja 3-Jan-11 11:22am    
[Comment from OP ,moved from answer]
I am so sory Frown
Hiren
I will not repeat it again

as you say, I have workrId so no need to include workerName
this what I thinking about

but teacher say how know the worker from ID , should add workerName
and I'm not convinced of what she said
for this I have confuse

thank you HIREN very much

now I have to remove workerName

is it true?

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