php - MySQL alternatives to binary auto-increment column? -


In MySQL we are allowed to automatically create unique primary keys.

However, it only works for integer columns. For example: There is no way to combine auto_increment with columns, for example:

  mysql> Create a Table User (ID Binary (6) Auto_Interment, Primary Key (ID)); # 1063 - Wrong column specifier for column 'ID'   

How can we create or implement auto-increment binary columns?

(Finding a solution that maintains atomicity and is comparable to the auto_increment integer column.)

A trigger that is called every entry should be safe for operational transactions and will do whatever you want.

Checkout on the trigger.

Comments