MySQL Forums
Forum List  »  Newbie

How to get rid of Composite Primary Key
Posted by: Abid Durrani
Date: April 27, 2021 04:30AM

Hi. This is my first time to be here in mysql forum. And its my first question to ask.

I have a PHP page where I want that when a customer comes to the restaurant so all the items he has ordered on the restaurant counter so these items are stored in database against single Order_ID.

My Order Table format is:

Order_ID, Item_ID, Item_Qty,Price, Total.......

Now here the problem is that this situation requires Composite Primary Key. Because here my Order_ID is PK and Item_ID is FK. So Its causing me problem. If i don't use Composite KEY and I store multiple records against 1 order ID so its not possible as PK does not allow duplicate.

Is there any way that I don't use Composite Key?

Thanks.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.