Perhaps you’re familiar with MySQL’s SERIAL
type, which is not actually a data type, but a shortcut for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE
.
One restriction of SERIAL
is that it forces us to use the BIGINT
data type, which is fine if you think you’ll need the extra space. But what if you want the same attributes for a smaller integer type, like INT
or MEDIUMINT
for example?
Enter SERIAL DEFAULT VALUE
.