From the course: MySQL Essential Training (2019)

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

The SERIAL type alias

The SERIAL type alias

- [Instructor] You may have noticed that many of our examples include an AUTO INCREMENT PRIMARY KEY id column. In this example you see we have it right here, type INT UNSIGNED UNIQUE AUTO INCREMENT PRIMARY KEY. Now what's interesting about that is I can take all of this, and I can replace it with the word SERIAL, which is effectively an alias for BIGINT UNSIGNED NOT NULL AUTO INCREMENT UNIQUE and PRIMARY KEY. And so if I go ahead and execute all of this, you'll notice I've got three tabs here. The first one of course, let's make a little bit of room here, so we can see all of this. The first one shows the INSERT values, that's our SELECT * FROM test. Then we have the DESCRIBE, which shows this column as a BIGINT UNSIGNED NOT NULL PRIMARY KEY with AUTO INCREMENT. And result 48 has this whole CREATE TABLE, so I can select that. And I can just paste it in here, and we'll see what it comes out as. So that would be the equivalent of the CREATE TABLE, where here I just have CREATE TABLE…

Contents