Seed ENUM Columns with Random Valid Values

Generate seed data for SQL ENUM columns by randomly selecting from defined values. Works with MySQL ENUM types and VARCHAR status columns.

Data Types

Detailed Explanation

Seeding ENUM and Status Columns

Many databases use ENUM types or VARCHAR columns with a limited set of valid values. The seed generator handles both patterns: explicit MySQL ENUM types and columns whose names suggest a categorical value.

MySQL ENUM Example

CREATE TABLE orders (
  id SERIAL PRIMARY KEY,
  customer_name VARCHAR(100) NOT NULL,
  status ENUM('pending', 'processing', 'shipped', 'delivered', 'cancelled') NOT NULL,
  priority ENUM('low', 'medium', 'high') DEFAULT 'medium',
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

For the status column, the generator parses the ENUM definition and randomly selects from pending, processing, shipped, delivered, or cancelled for each row. Each value has an equal probability of being selected.

Name-Based Status Detection

Even without an explicit ENUM type, the generator recognizes columns named status and produces values from a built-in pool: active, inactive, pending, suspended, archived. Similarly, columns named role receive values like admin, user, editor, moderator.

Column Name → Category Mapping

Column Name Generated Values
status active, inactive, pending, suspended, archived
role / user_role admin, user, editor, moderator, viewer
category electronics, clothing, food, books, sports, home, garden

Distribution

The generator uses uniform random selection. In a sufficiently large dataset (100+ rows), each ENUM value will appear approximately the same number of times. This is intentional — it ensures every value gets tested.

Testing ENUM Features

Realistic enum data helps you verify dropdown filters, badge/label rendering, status transition logic, and aggregate queries like "count orders by status".

Use Case

Your application has an order management system with status-based workflows. You need seed data where orders are distributed across all status values so you can test the status filter dropdown, color-coded badges, and the state machine that governs status transitions.

Try It — Database Seed Generator

Open full tool