Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Modifying table structure
5. Removing columns
Adding NOT NULL constraints
Summary

Instruction

Good job. Our next goal is to remove a column from a table. The flight table contains the column operated_by which we don't need. Luckily, for this task, there is a single statement which works in every database engine:

ALTER TABLE flight DROP COLUMN operated_by;

The statement above deletes the column operated_by along with all the data that was stored in the column. All other columns are kept intact.

Exercise

We want to keep the stores' addresses in another table. For now, remove the column city from the store table.

Can you see any data in the columns id and opening_date?

Stuck? Here's a hint!

Type:

ALTER TABLE store DROP COLUMN city;