Reputation: 175
I am designing a MySQL data table to store e-business orders,each order has an unique order number looks like '20160223xxxxxx',it is generated by a specified algorithm to ensure it is unique in the table. I am wondering if we still need an auto-increment field as primary key in the table since I think the order number seems also can be the primary key.
Upvotes: 0
Views: 371
Reputation: 1269503
You do not need an auto-incremented id, because you have one. However, I am a big fan of synthetic primary keys:
Upvotes: 1
Reputation: 17272
You don't need to use an auto-inc field. Use the unique identifier as the PK of the table. It will save space.
Upvotes: 0