In MySQL, an enumerated type, or enum for short, is a string with a predefined set of values. Any fields you define using enum can only be assigned a value from that predefined set. For instance, the status of a traffic light can be defined as either red, yellow or green. In MySQL you can represent these colors relatively easily using an enum. Nevertheless, with PhpMyAdmin, the free administration tool for MySQL, you can define and represent enum types even faster.
Step 1
Select the database by clicking on its name from the list on the left-hand side of the phpMyAdmin page.
Video of the Day
Step 2
Type "enumtest" in the "Name:" field of the "Create new table on database" section. Type "1" in the "Number of fields:" box. Click the "Go" button.
Step 3
Type "an_enum" in the "Field" edit box. Select "ENUM" from the "Type" drop-down list. Type "'red', 'yellow', 'green'" in the "Length/Values" field. Select "As defined:" from the "Default" drop-down list. Type "red" in the field immediately below it. Click "Save."
Step 4
Click the "Insert" tab. Select either "red", "yellow" or "green" from the "Value" drop-down list. Click the "Go" button.
Video of the Day