foriegn and primary keys

Tech

Registered User.
Local time
Today, 11:27
Joined
Oct 31, 2002
Messages
267
hi there. i hope you can help me in a nice easy english language hehe.

I am on a question in my coursework which says:

"Identify all primary and foreign Key fields"

now - i have made tables (on paper - there is no real database access here) and i have identified hopefully nearly all the appropriate fields

www.technosoft2000.co.uk/table.txt

that is my table and fields i have identified from coursetext.

now i am wondering - have i done this right? i know this question maybe stupid but i have no other way of asking if i have done it correctly....



i am wondering - have i uniquely identified the primary key fields?
what about foreign keys? I know i havent done this yet but why and how would i use a foriegn key in this situation?

the Usage table is a table that joins 2 tables together




i would also like to know if i need to put in the fields from other tables into other tables like for example :

a supervisor will be monitoring a manufacturing run - so in the manufacturing run would i have the supervisor No. field in there as a foriegn key or am i wayy wrong?


i hope you can explain this - i am really confused :(

Many thanks:)
 
thanks :)

this stuff will never be put in a database at all - its not required to but i understand what you are saying :)

thanks

and anything else to be fixed/changed?

have i answered the question properly?

"identify all primary and foreign key fields"
 
some questions arose.

if a Product has a Produce number and a plant number - would plant number be a foriegn key? is there any need for a foreign key?

each product is identified by the primary key (prod no)

am i correct at putting in the plant no?


also - i have the entity diagram drawn out with its cardinality

most of them are 1 to many apart from usage - thats a joining table.

would this mean that for each entity - there must be a field from its joining entity and must be given a foriegn key?
 
hmm

sorry but i dont quite understand

firstly - we are not going to put this in physically in a database at all - its all paper :)

lets say that we have 2 entities:


Plant
Supervisor


Plant has:

Plant no.
Plant Name

Supervisor has:

Supervisor no.
Supervisor Name.
Supervisor address




now - i have done an entity diagram on this. its a 1 to many cardinality.

when i sit down on paper and write the table fields etc...

when i come to write the plant table - do i include the supervisor no. field as a foriegn key in the plant table?

do i put in the Plant no. in the supervisor table as a foriegn key?

i would just like to confirm this - i need to know if i am thinking on the correct lines :)

its because all that this question says:

"b) List all entity attributes both stated and assumed"

??


i appreciate your help :)
 
Last edited:
www.melcfanbook.co.uk/entitydiagrammynewapproach.jpg
www.melcfanbook.co.uk/coursetext.txt



i have some questions..i hope u dont mind. :(

where i have placed the questions marks in that diagram - should the lines be there even tho the coursetext doesnt say any relation between them?


when u think about it - 1 plant can have MANY Manufacturing Runs

1 Product is made up of MANY components


??



if the above is true then does that mean in the Component and Product relationship - BOTH tables would have each other primary keys as foreign keys?



Product:

Product_no (PRI)
Product_name
Component_No (FOR)

Component:

Component_No (PRI)
Component_Name
Product_no (FOR)


like that? or would only one of the tables have it?

i am really confused on this
 
Last edited:
so there shouldnt be a relationship between Plant and MF Run entities?

same for Product and component?


www.melcfanbook.co.uk/coursetext.txt is the spec - im not saying at all in anyway for you to give me the answer - i just need to know if i am correct and if im wrong - what is wrong

many thanks :)
 

Users who are viewing this thread

Back
Top Bottom