Database Tools

MySQL ENUM & SET Generator

Generate standards-compliant MySQL ENUM and SET column definitions, CREATE TABLE schemas, and ALTER TABLE statements with character escaping, default value selection, and member limit validation.

Quick Presets: Load realistic ENUM and SET configurations
An ENUM column stores exactly one permitted value chosen from the list (stored as a 1 or 2-byte integer).
For SET, select default combinations in the Values tab.
Defined Allowed Values
Edit in-place, drag or move up/down, or remove.
One per line, CSV, or JSON array
MySQL Specification Validation

Real-time verification of member count limits, duplicate items, trailing spaces, and character encoding safety.

All definitions conform to MySQL 8.0+ standards.
1 Byte
Row Storage
65,535
Max Allowed
1 to 7
Internal Index
MySQL ENUM & SET Storage Rules:
  • ENUM storage: 1 byte for 1 to 255 members; 2 bytes for 256 to 65,535 members.
  • SET storage: 1 byte for 1 to 8 members; 2 bytes for 9 to 16; 3 bytes for 17 to 24; 4 bytes for 25 to 32; 8 bytes for 33 to 64 members. (Maximum 64 members).
  • Index 0: In ENUM, index 0 is reserved for an empty string error value inserted when strict SQL mode is disabled.
  • Trailing spaces: Automatically stripped by MySQL upon column creation.
Generated SQL
Type: ENUM
Members: 7
Storage: 1 Byte
Default: 'pending'
MySQL 8.0 Tip: Appending new members to the very end of an existing ENUM column takes advantage of ALGORITHM=INSTANT, modifying the table without any downtime or table rebuild.
MySQL Architectural Comparison: ENUM vs SET vs Foreign Key vs VARCHAR
Feature MySQL ENUM MySQL SET Foreign Key Lookup Table VARCHAR(N) + App Check
Permitted Values Exactly 1 choice from list 0 to 64 choices simultaneously Dynamic rows in parent table Any string conforming to app logic
Internal Storage 1 or 2 bytes integer 1 to 8 bytes bitmask Foreign key INT (4B) or BIGINT (8B) Length byte + actual characters
Storage Limit Up to 65,535 distinct items Strictly 64 distinct items Unlimited (table rows) Up to 65,535 bytes per row
Sorting (ORDER BY) Sorted by internal index order Sorted by bitmask integer value Sorted by JOIN column alphabetically Sorted alphabetically by collation
Adding New Member Instant (at end in MySQL 8+) Requires table rebuild Instant (INSERT INTO lookup_table) Instant (application code update)
Best Used For Static lifecycle states (order, user role) Multi-flag capabilities & preferences Frequently changing or user-edited lists Free-form or highly dynamic strings
How to Use the MySQL ENUM & SET Generator
1. Choose Data Type & Presets

Select between ENUM (single choice) and SET (multiple choices), or load one of 10 real-world templates.

2. Manage Member Values

Add, reorder, sort, or paste bulk values from multiline lists, CSVs, or JSON arrays with case transforms.

3. Configure Schema Options

Set Table & Column names, NULL/NOT NULL, default value, charset collation, comments, and column position.

4. Copy or Download SQL

Export Column Definitions, full CREATE TABLE schemas, or ALTER TABLE migrations to clipboard or .sql file.

Frequently Asked Questions

An ENUM column represents a single choice chosen from a predefined list of allowed string values (stored internally as a 1 or 2-byte integer index from 1 to 65,535). In contrast, a SET column can hold zero, one, or multiple values chosen from a list of up to 64 members (stored internally as a bitmask integer where each member corresponds to a single bit).

MySQL stores ENUM values as compact integer indexes rather than raw text strings. If an ENUM has 1 to 255 member elements, MySQL allocates 1 byte per row (values 1 to 255). If it has 256 to 65,535 elements, it allocates 2 bytes per row. Index 0 is reserved for invalid or error values (such as an empty string inserted in non-strict SQL mode).

SET values are stored as bitmasks. Member 1 is bit 1 (decimal 1), member 2 is bit 2 (decimal 2), member 3 is bit 3 (decimal 4), and so on up to 64 members. Storage requires 1 byte for 1–8 members, 2 bytes for 9–16, 3 bytes for 17–24, 4 bytes for 25–32, and 8 bytes for 33–64 members.

In MySQL, if an ENUM element contains a single quote, it must be escaped either by doubling the single quote ('O''Connor') or by prepending a backslash ('O\'Connor'). Our generator automatically escapes single quotes, backslashes, and special characters.

In MySQL 8.0 and later, adding a new member to the end of an ENUM list can be executed instantly using ALGORITHM=INSTANT without table copying or table locking. However, inserting a new element in the middle, reordering existing elements, or shortening the list requires a full table rebuild (ALGORITHM=COPY or INPLACE).

Using numeric strings as ENUM elements creates severe ambiguity. For example, in an ENUM('3', '2', '1'), querying "WHERE col = 2" will look for internal index 2 (which is string value '2'), but if you query "WHERE col = '2'", it compares by literal string. To prevent confusing bugs, always use descriptive alpha-character names for ENUM values.

You can query SET columns using MySQL's built-in FIND_IN_SET('value', column) function, or using the LIKE operator ('%value%'), or bitwise AND operators on the numeric representation (e.g. "SELECT * FROM users WHERE permissions & 3 = 3" to check for multiple bits).

If the column is defined as NULL, NULL is valid. If it is defined as NOT NULL and strict SQL mode (STRICT_TRANS_TABLES or STRICT_ALL_TABLES) is active, inserting an invalid value throws an error. In non-strict legacy mode, MySQL inserts an empty string '' with special index 0.

By default, MySQL sorts ENUM columns based on their internal index order (the order in which they were declared in the ENUM definition), NOT in alphabetical order! NULL values appear first in ascending order. If you need alphabetical sorting, you can order by CAST(column AS CHAR).

Use ENUM when the set of values is static, small (< 15 items), and represents core application state (like order status or task priority). Use a normalized Foreign Key lookup table when values change frequently, require user-facing descriptions or localized names in multiple languages, or need to be edited by non-technical administrators via an admin panel.

Yes! PaceTools MySQL ENUM Generator provides ready-to-run ALTER TABLE ADD COLUMN, ALTER TABLE MODIFY COLUMN, and ALTER TABLE CHANGE COLUMN statements, complete with table name, column position (FIRST / AFTER), charset, collation, and comments.

Yes. All parsing, validation, SQL query generation, and export transformations run 100% locally in your web browser. No schema details, column values, or query snippets are ever sent to our servers.