Which database systems support an ENUM data type, which don't? Which database systems support an ENUM data type, which don't? database database

Which database systems support an ENUM data type, which don't?


I know that MySQL does support ENUM:

  • the data type is implemented as integer value with associated strings
  • you can have a maximum of 65.535 elements for a single enumeration
  • each string has a numerical equivalent, counting from 1, in the order of definition
  • the numerical value of the field is accessible via "SELECT enum_col+0"
  • in non-strict SQL mode, assigning not-in-list values does not necessarily result in an error, but rather a special error value is assigned instead, having the numerical value 0
  • sorting occurs in numerical order (e.g. order of definition), not in alphabetical order of the string equivalents
  • assignment either works via the value string or the index number
  • this: ENUM('0','1','2') should be avoided, because '0' would have integer value 1


PostgreSQL supports ENUM from 8.3 onwards. For older versions, you can use :

You can simulate an ENUM by doing something like this :

CREATE TABLE persons (  person_id int not null primary key,  favourite_colour varchar(255) NOT NULL,  CHECK (favourite_colour IN ('red', 'blue', 'yellow', 'purple')));

You could also have :

CREATE TABLE colours (  colour_id int not null primary key,  colour varchar(255) not null)CREATE TABLE persons (  person_id int not null primary key,  favourite_colour_id integer NOT NULL references colours(colour_id),);

which would have you add a join when you get to know the favorite colour, but has the advantage that you can add colours simply by adding an entry to the colour table, and not that you would not need to change the schema each time. You also could add attribute to the colour, like the HTML code, or the RVB values.

You also could create your own type which does an enum, but I don't think it would be any more faster than the varchar and the CHECK.


Oracle doesn't support ENUM at all.