Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have table ordertable{customer_id,oid,order_quantity,Order_amount,date}

in this table i want generate oid as(o1,o2,o3,o4..............etc) and make this as primary key.Is it possible in mysql



Please help me.








Thanks
Posted

Hello,

You can not directly do so. However this article[^] should help you in achieving this.

Regards,
 
Share this answer
 
I don't encourage you to use nvarchar column as a primary key.
Why ? Because indexing an nvarchar is much more costly than an integer type.
Better have an autogenerated primary key of integer type ; this does not prevent the use of a nvarchar column to store a generated order id. By doing this you will have much better performances when you will query your orders table.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900