What type to use for an ID number composed of lett

2019-09-05 09:36发布

问题:

What type should I use to create an ID number composed of letters and numbers and which will also increment, e.g. "HP0001" increment to "HP0002"

回答1:

Varchar of "X" lenght, or 2 fields, 1 varchar and another numeric, both has to be primary keys

You can check what im talking about in this example:

http://sqlfiddle.com/#!2/df078/4