ID #1038

How do I create ENUM and SET data types with SQLyog?

The implementation in MySQL for defining ENUM and SET types is so that the list of valid values are specified with the same syntax as you specify the 'length' of other data types.

So in the CREATE/ALTER table statement you write the possible values enclosed with single-quotes " ' " and divided by comma " , ". SQLyog has a GUI to handle this in the "Create Table" and "Alter Table" dialogs as well as the Columns-transformation option of the Import External Data Wizard. When the 'length' cell for an ENUM/SET gets focus this dialog shows:

To allow 'empty string' just add '' (two single quotes) to the list.

Also note that if you want a default value write the default value in the "Default" -column - but without quotes!

 

Tags: -

Related entries:

You can comment this FAQ