CJCoding With Joseph
15free / daySign inCreate account

Migrate the Instructors Table

Apply a four-step migration to instructors in one script: add middle_name as a TEXT column (NULL allowed), add is_active as an INTEGER column that is NOT NULL with DEFAULT 1, rename the office column to room, and drop the phone column. SQLite allows exactly one change per ALTER TABLE, so the script is four statements; the other columns and all 12 rows stay as they are.

Expected result:

Table instructors
✓ id INTEGER PRIMARY KEY
✓ first_name TEXT NOT NULL
✓ last_name TEXT NOT NULL
✓ email TEXT NOT NULL
✓ department_id INTEGER
✓ hire_date TEXT
✓ salary REAL
✓ room TEXT
✓ is_tenured INTEGER NOT NULL DEFAULT 0
✓ title TEXT
✓ middle_name TEXT
✓ is_active INTEGER NOT NULL DEFAULT 1
✓ department_id REFERENCES departments(id)
✓ UNIQUE (email)
Hints4 available
Topics:
ALTER & DROP
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (sel, ins, desc)

Results

Run your SQL to see every statement's output here, then how it compares with the expected answer.

Not sure what is in a table? SHOW TABLES lists them and DESCRIBE students shows the columns — or open the database browser on the left.