Chapter 9 · Lesson 4 of 9

Feel Why Packed Lists Break 1NF

Discover why comma-separated lists in a single column break first normal form, and why searching them with LIKE is fragile.

First normal form says each column should hold one value, not a comma-separated list of values.

In the bad table below, each order stores multiple product names in a single text column. That means the database cannot reason about products cleanly. You end up searching inside strings instead of working with individual rows.

Try the challenge and notice how awkward it feels compared with a proper order_items table.

Sample data

This lesson loads the orders_packed table (products stored as text lists) into DuckDB in your browser with one click, so you can run every example without uploading anything.

Setup SQL for orders_packed
CREATE OR REPLACE TABLE orders_packed (
    order_id INTEGER,
    customer_name VARCHAR,
    products VARCHAR
  );

INSERT INTO orders_packed VALUES
    (2001, 'Alice Kim', 'Keyboard, Mouse'),
    (2002, 'Ben Fox', 'Webcam'),
    (2003, 'Cara Lane', 'Keyboard, USB-C Hub'),
    (2004, 'Dan Reed', 'Desk Mat');

Practice challenge

Find the orders whose products list mentions Keyboard. Return order_id and products, ordered by order_id.

Hint: You will probably need LIKE because products are packed into one text field.

Run your query in the editor and the lesson checks the result automatically.

Open this lesson in the SQL editor

Lessons in Normalization

See why well-designed databases split data into related tables, feel update, insert, and delete anomalies, and learn 1NF, 2NF, and 3NF.

  1. 01 · Why Normalization Matters
  2. 02 · Feel the Update Anomaly
  3. 03 · One Row to Update in a Good Schema
  4. 04 · Feel Why Packed Lists Break 1NF
  5. 05 · Order Items Feel Better
  6. 06 · Feel the Delete Anomaly
  7. 07 · Products Can Exist Without Orders
  8. 08 · 1NF, 2NF, and 3NF
  9. 09 · Why We Build Tables in Normal Forms

Related guides