Reputation: 143
I'm not sure if this question is right, but what I really want to know is, how do we make a customized auto-increment in mysql.
I only know when we made an auto-increment for a specific field then it will result as:
1,2,3,4,etc
What I really want for the outcome is, for example I want the auto-increment format to be like ID-001, then the auto-increment in my specific field will be:
ID-001,ID-002,ID-003, ... and so on.
Could that be possible?
Thanks in advance!
Upvotes: 0
Views: 128
Reputation: 16835
I think you can create this mysql view for it. you cab define view something like below.
select `table1`.`id` AS `id`,concat('ID-',`table1`.`id`) AS `custom_auto_inc` from `table1`
Upvotes: 1