Learn with Abdou

Chapter 9 · Concept 5 of 6 · Practice

Change the shape, not the facts

ALTER TABLE ADD COLUMN, DROP TABLE IF EXISTS, what the engine cannot do · level 1 of 6

Opening your saved work…

Sign in to save across devices → · Download your guest work before switching accounts.

Change the shape, not the facts · ALTER TABLE ADD COLUMN, DROP TABLE IF EXISTS, what the engine cannot do · level 1 of 6

A column for the manager's name

Level 1: Watch it answered · Exercise 1 of 1

The shops table needs a manager_name column. Watch the ALTER, run it, and look at what the existing rows hold.

Data: Northshore Coffee. Every run starts from a fresh copy, so nothing you try here is permanent.

Why it works, clause by clause

  1. ALTER TABLE shops: the table whose shape changes.
  2. ADD COLUMN manager_name TEXT: the new column and its type. No DEFAULT, so every existing row gets NULL in it.
  3. Nothing else moves: the eight rows are still there with every other value intact.

From the reading: Change the shape, not the facts, paragraph 1

The queryOpening the database…
ALTER TABLE shops
ADD COLUMN manager_name TEXT;
Open in the playground

Query results

Run it to see the result here.

Run it to see the result here.

Practice here is evidence for you and your instructor, never a grade. Grades live in Canvas.