← Back to ALTER & DROP
Question 25
Migrate the Instructors Table
Migrate the Instructors Table
Apply a four-step migration toinstructorsin one script: addmiddle_nameas aTEXTcolumn (NULL allowed), addis_activeas anINTEGERcolumn that isNOT NULLwithDEFAULT 1, rename theofficecolumn toroom, and drop thephonecolumn. SQLite allows exactly one change perALTER 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
Sign in to use hintsTopics:
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.