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.

Enumeration types

Enumeration types

- [Instructor] MySQL provides two unique types of work from lists of strings. For this lesson, we'll use the scratch database, so I'm going to type USE scratch, and I'll execute that. The enum type stores one value from a list of possible values, so I'm going to come out here to my exercise files and I'm going to copy and paste all of this text into MySQL Workbench, and you'll notice when I execute all of this, I get results, I get six rows in my table, Pablo, Henri, Jackson, and Pablo, Henri, and Jackson. I'm just going to close this for a moment. You notice that I've created this table with two columns. An ID column, which is an auto-incremented id, and an enum column, with a list of strings. Pablo, Henri, and Jackson. And the way the enum works is it uses that list of strings, but it stores the position of the string rather than the string itself. So when I insert Pablo it actually just inserts a one into the column, and Henri is two and Jackson is three, and so when I retrieve it,…

Contents