?
Solved

weak entity and its primary key

Posted on 2005-05-11
2
Medium Priority
?
3,164 Views
Last Modified: 2008-01-09
Hi,

   I know that for weak entity, we have to include the primary keys of the strong attribute as one of the weak entity's attribute. I would like to know if it is possible that the primary keys of the weak entity does not include the primary key of the strong entity which it is related to? Lets say in one question, the answer given was

http://www.experts-exchange.com/Databases/Q_10102690.html?query=weak+entity&clearTAFilter=true

Strong entity...
Table Orders
ID        int      Primary Key
OrderNum  varchar
OrderDate datetime

Table Items
ID        int      Primary Key
Desc      varchar

weak....
Table OrderDetail
OrderID   int      Foreign Key (references Order.ID)
ItemID    int      Foreign Key (references Item.ID)
Qty       int

So if I give a unique number lets say OrderDetail_id as the primary key, do I still need the OrderID and ItemID as one of the primary keys in the weak entity?
0
Comment
Question by:hongjun
2 Comments
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 1000 total points
ID: 13976905
If you have a separate field (OrderDetail_ID) as the Primary Key of the OrderDetail table, then NO you would not also include OderID and ItemID as part of the primary Key.  Howver, you should create a Unique Index on the combination of OrderID and ItemID in that table, as it is not allowed to have multiple records with the SAME combination of OrderID and ItemID in the OrderDetail table.

AW
0
 
LVL 33

Author Comment

by:hongjun
ID: 13978476
Hey.. Arthur_Wood,

Thanks for your input. It was accidentally posted by a friend using my account without me logging off first.
As such, this question is closed now.

Cheers
hongjun
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question