How to add a series of string in incrementing id in any table?

前端 未结 4 691
野趣味
野趣味 2021-01-21 14:46

I have MySQL Table with an Order table in a DB this table has an auto-incremental id. Up-till now we have general numeric Order-ID likewise 1,2,3,4,5... From now onwards I have

4条回答
  •  天涯浪人
    2021-01-21 15:25

    You can't add prefixes directly to the database. However, when selecting it you can prepend it.

    SELECT concat('A', id) as id FROM table
    

    To get the effect of starting from 20000 you can set the auto increment starting value.

提交回复
热议问题