At the database level I am trying to understand the difference between having a PK of one table be both a PK and FK in another table vs just being a FK.
As an example, I have ORDER, ORDER_ITEM and ITEM entities. According to my Kroenke text, in the ORDER_ITEM table the PK is Order#, LineItem# (one line for each item sold in an order) and item# is simply a FK in the ORDER_ITEM table. I think the PK of the ORDER_ITEM table should be Order#, Item#.
My guess is it has to do with what if you delete an item# from the ITEM table. IF it is part of the PK for ORDER_ITEM than that would be bad, but isn't it also bad if Item# is simply a FK in the ORDER_ITEM table? (I guess you couldn't turn on referential integrity between Item and Order_item)
THANKS for your help!
L3w 0 Newbie Poster
debasisdas 580 Posting Genius Featured Poster
BitBlt 452 Practically a Master Poster Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.