Should an order details table have autonumber field orderdetailsID?

W

Will

I have tblOrder with the fields OrderID, OrderDate & CustomerID. I have
just made tblOrderDetails with the fields OrderDetailsID, OrderID, ItemNo,
Quantity. My question is do I need the OrderDetailsID (autonumber) field?
are there any advantages to it?

thanks in advance
 
R

Rick Brandt

Will said:
I have tblOrder with the fields OrderID, OrderDate & CustomerID. I
have just made tblOrderDetails with the fields OrderDetailsID,
OrderID, ItemNo, Quantity. My question is do I need the
OrderDetailsID (autonumber) field? are there any advantages to it?

thanks in advance

Every table in a proper database needs a Primary Key. If you have other
field(s) that you can use as a PK then the AN is not necessary. Some people
would not want an Order to list the same ItemNo on more than one line of an
Order. For them a PK consisting of OrderID and ItemNo would work just fine.
Others might want the capability to enter the same ItemNo on more than one line
so they would need "some" other field added to the table to establish uniquness.
In that case an AN would solve the problem.
 
G

Guest

hi, If the Order ID and Item number are unique for each row then you don't
need any oderdetail ID and you can use the Order_ID and Item_Number as the
concatenated key. However if this is not so then you should create the Order
detailID as the key and it will be useful to have it auto-numbered.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top