复合(字母数字)主键和自动递增

是否可以在MySQL中制作结合了alpha元素和数字的自动增量功能?

Is it possible to make an auto-increment function in MySQL that combines alpha elements and numeric?

我有一个具有QAb99,QAb101,QAd9003等键的现有系统.最大数字部分的范围为1到9999,而字母以QA开头,范围从QAa到QAd等,最终将通过QAd9999到QAe1等

I have an existing system with keys like QAb99, QAb101, QAd9003, etc. The max numeric portion ranges from 1 to 9999, while the letters begin with QA and range from QAa to QAd, etc. and will eventually pass QAd9999 to QAe1, etc.

在SQL或SQL外部(例如php脚本)管理生成新密钥是否更好?

Is it better to manage generating new keys in SQL or outside of SQL (i.e. php script)?

谢谢.



 1 条回答