How to Do ENUM in PhpMyAdmin

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.
Image Credit: monkeybusinessimages/iStock/Getty Images

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.

Advertisement

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.

Advertisement

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."

Advertisement

Advertisement

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

Advertisement

Advertisement

references

Report an Issue

screenshot of the current page

Screenshot loading...