PGoCareerGoCareer prep tools
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

SQL · Theory

ENUM

← All stacks

Theory

299/439

ENUM

ENUM('pass','fail') allows only those strings. Compact. Changing the list later is ALTER TABLE pain. A lookup table (grades) is more flexible. Don’t ENUM a list that product will grow weekly.

Empty string / invalid values can become '' or error depending on sql_mode. Strict mode is your friend.

Trap — ENUM as a substitute for a real table of 50 statuses.

On the example next to this theory: ENUM: create two demo rows, then SELECT qty >= 2 ordered. Say which labels come back.

Exam tip

status ENUM('pass','fail') — or a status table if it grows.

ENUM — sample query

-- ENUM
CREATE TABLE demo (
  id INTEGER PRIMARY KEY,
  label TEXT NOT NULL,
  qty INTEGER DEFAULT 0
);
INSERT INTO demo (id, label, qty) VALUES
  (1, 'alpha', 2),
  (2, 'beta', 5);
SELECT label, qty FROM demo WHERE qty >= 2 ORDER BY qty DESC;

ENUM: create two demo rows, then SELECT qty >= 2 ordered. Say which labels come back.

Short notes

  • DefENUM = fixed list of strings on the column.
  • RuleTiny stable lists only. Else a table.
  • TrapGrowing ENUM every sprint.

Questions

1

When not ENUM?

299 / 439

P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.