0
0
MySQLquery~5 mins

ENUM and SET types in MySQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the ENUM data type in MySQL?
ENUM is a string object that can have only one value chosen from a list of allowed values defined when the column is created.
Click to reveal answer
beginner
How does the SET data type differ from ENUM in MySQL?
SET allows storing zero or more values from a predefined list, meaning multiple values can be stored in one column, unlike ENUM which stores only one.
Click to reveal answer
intermediate
What happens if you try to insert a value not listed in an ENUM column?
MySQL inserts an empty string ('') as a special error value if the inserted value is not in the ENUM list.
Click to reveal answer
advanced
How are ENUM and SET values stored internally in MySQL?
ENUM values are stored as numeric indexes representing the position in the list. SET values are stored as bitmaps where each bit represents a possible value.
Click to reveal answer
intermediate
Can you add new values to an ENUM or SET column after the table is created?
Yes, but you must use ALTER TABLE to modify the column definition to include new allowed values.
Click to reveal answer
Which MySQL data type allows storing multiple values from a predefined list in a single column?
AENUM
BSET
CVARCHAR
DINT
What value does MySQL store if you insert an invalid ENUM value?
ANULL
BThe invalid value as is
CEmpty string ('')
DZero
How are ENUM values stored internally in MySQL?
AAs numeric indexes
BAs strings
CAs bitmaps
DAs JSON
Which statement is true about SET columns?
AThey can store multiple values from the list
BThey cannot be altered after creation
CThey can store only one value from the list
DThey store values as text
To add a new allowed value to an ENUM column, you should:
AInsert the new value directly
BUpdate the ENUM list automatically
CDrop and recreate the table
DUse ALTER TABLE to modify the column
Explain the difference between ENUM and SET types in MySQL and give an example use case for each.
Think about how many values you want to store in one column.
You got /4 concepts.
    Describe how MySQL stores ENUM and SET values internally and why this matters for performance.
    Consider how numbers and bits are faster to process than strings.
    You got /4 concepts.