Skip to content

Instantly share code, notes, and snippets.

@ibnuh
Created May 10, 2017 06:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ibnuh/7ba2c221ca86888280b883e4a693af76 to your computer and use it in GitHub Desktop.
Save ibnuh/7ba2c221ca86888280b883e4a693af76 to your computer and use it in GitHub Desktop.
MYSQL: Bikin auto increment with prefix. Ex: GSF00001
SELECT CONCAT('ABC1',LPAD(id,5,'0')) FROM tablename;
http://stackoverflow.com/questions/3245429/autoincrement-of-table-id-using-string-combination-in-database-automatically
http://stackoverflow.com/questions/12424153/how-to-use-auto-increment-value-in-mysql-concat-function
http://stackoverflow.com/questions/10605383/mysql-creating-a-table-with-auto-increment-and-concatenating-the-values-generat
http://stackoverflow.com/questions/17266442/in-mysql-how-can-i-use-the-autoincrement-value-in-another-column-at-the-time-of
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment