sql - MySQL: ID that has a pattern (primary key) -
i want have userid
has pattern. instead of having id of 0, 1, 2.. etc, want adm-001, adm-002.
what best way achieve this?
i have absolutely no idea can't provide anything.
i aware not code writing site, suggestions appreciated.
thank in advance. :( :)
don't mess pk data itself; that's not purpose of pks. kill performance , pain manage.
just format on client, or in select query:
select ('adm' + lpad(id, 3, '0')) formattedid table;
Comments
Post a Comment