← QCE Digital Solutions Unit 3

SQL ALTER TABLE

An SQL command that changes the structure of an existing table, such as adding, modifying or dropping a column. Existing rows are kept, and a new column is empty (NULL) for them.

Understanding SQL ALTER TABLE in QCE Digital Solutions Unit 3

What it does: MODIFY inside ALTER TABLE changes the definition of a column that already exists, and the existing rows stay in the table. ADD creates the column, and existing records have no value for it yet, so they hold NULL. Dropping a column permanently removes its data for every row. The other columns and rows remain. ALTER TABLE students ADD email VARCHAR(50); is correct because SQL needs the word TABLE to know a table structure is being changed.

Common mistakes: The column name must come before its data type. It should be ADD COLUMN Email VARCHAR(50);. SQL has no CHANGE TABLE command. To change the structure of an existing table you write ALTER TABLE Student.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 251–337) and word search (Modules 194–337).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which statement adds a new column called email to an existing students table?
ALTER TABLE students ADD email VARCHAR(50);CREATE TABLE students ADD email VARCHAR(50);
Matches
ALTER students ADD email VARCHAR(50);
↓
The TABLE keyword is missing. The command must be ALTER TABLE followed by the table name.
Applying
Meanings
Term
ALTER TABLE
Meaning
An SQL command that changes the structure of an existing table, such as adding, modifying or dropping a column. Existing rows are kept, and a new column is empty (NULL) for them.
Practice
ALTER TABLE students ADD COLUMN email VARCHAR(50);
Testing
Gaps
TABLE students ADD email VARCHAR(50);
Check Answer
Spots
1ALTER TABLE Student
2ADD COLUMN VARCHAR(50) Email;

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Moray Eel' badge — Lurking Debugger, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which statement adds a new column called email to an existing students table?
A. ALTER TABLE students ADD email VARCHAR(50); ✓
B. CREATE TABLE students ADD email VARCHAR(50);
ALTER TABLE changes a table that already exists. CREATE TABLE makes a brand new table.
2. True or false: ALTER TABLE can change the structure of a table without deleting the table.
A. True ✓
B. False
ALTER TABLE edits the structure (columns) of the existing table, so the table and its rows stay in place.
3. A table has 10 rows. You run ALTER TABLE students ADD house VARCHAR(10); What value does the new house column hold for the 10 existing rows?
A. The word 'house' in every row
B. NULL (empty) in every row ✓
A new column has no data yet, so existing records show NULL until you UPDATE them.
4. Which statement removes the column nickname from the students table?
A. ALTER TABLE students DROP COLUMN nickname; ✓
B. DROP TABLE students COLUMN nickname;
Use ALTER TABLE with DROP COLUMN to remove one column. DROP TABLE removes the whole table.
5. After ALTER TABLE students DROP COLUMN nickname; what happens to the data stored in that column?
A. It is kept and moved to a new column
B. It is deleted along with the column ✓
Dropping a column permanently removes its data for every row. The other columns and rows remain.

Match the Pairs

ALTER TABLE students ADD email VARCHAR(50); → Adds a new column called email to the students table. Existing rows are kept and get NULL in the new column.
ALTER TABLE students DROP COLUMN house; → Removes the house column from the students table, along with all the data stored in that column.
Change the data type or size of an existing column, such as making the name column hold up to 100 characters → ALTER TABLE products MODIFY name VARCHAR(100);
Add a new column to an existing table so that rows already stored have NULL in it until they are updated → ALTER TABLE orders ADD status VARCHAR(20);
ALTER students ADD email VARCHAR(50); → The TABLE keyword is missing. The command must be ALTER TABLE followed by the table name.
ALTER TABLE students ADD COLUMN; → The new column has no name and no data type. ADD must be followed by a column name and its data type.

Key Term

ALTER TABLE
An SQL command that changes the structure of an existing table, such as adding, modifying or dropping a column. Existing rows are kept, and a new column is empty (NULL) for them.

Fill in the Blanks

1. ALTER TABLE students ADD email VARCHAR(50);
Hint: Type the first keyword of the command that changes an existing table's structure.
2. ALTER TABLE students ADD email VARCHAR(50);
Hint: Type the keyword that adds a new column to the table.
3. ALTER TABLE students DROP COLUMN house;
Hint: Type the keyword that removes a column from the table.
4. ALTER TABLE products MODIFY price DECIMAL(6,2);
Hint: Type the keyword that changes the definition of a column that already exists.
5. ALTER TABLE students ADD email VARCHAR(50); SELECT * FROM students WHERE email IS NULL;
Hint: Type the empty value that existing rows hold in a newly added column.

Spot the Error

Question 1
A ALTER TABLE Student
B ADD COLUMN VARCHAR(50) Email;
C SELECT * FROM Student;
Line B — The column name must come before its data type. It should be ADD COLUMN Email VARCHAR(50);
Question 2
A SELECT * FROM Student;
B CHANGE TABLE Student
C DROP COLUMN Phone;
Line B — SQL has no CHANGE TABLE command. To change the structure of an existing table you write ALTER TABLE Student.
Question 3
A ALTER Book TABLE
B MODIFY Title VARCHAR(100);
C SELECT * FROM Book;
Line A — The keywords are in the wrong order. The command is ALTER TABLE followed by the table name: ALTER TABLE Book.
Question 4
A ALTER TABLE Student
B ADD YearLevel INT;
C UPDATE Student
D SET YearLevel == 7;
Line D — SQL uses a single = to assign a value in SET. The new column is NULL for existing rows until UPDATE fills it, so it should be SET YearLevel = 7;
Question 5
A ALTER TABLE Product;
B DROP COLUMN Weight;
C SELECT * FROM Product;
Line A — The semicolon ends the statement too early, leaving DROP COLUMN on its own. The first line should be ALTER TABLE Product with no semicolon.

Student with a class code? Join your class →