CodeBlanks Logo Icon CodeBlanks

Summary - ALTER and DROP

Safely update a table with ALTER TABLE.

Summary - ALTER and DROP

ALTER TABLE adds/drops/modifies columns. DROP TABLE removes a table entirely.

ALTER TABLE products
ADD COLUMN stock INT;

Summary ALTER query.

Practice Summary - ALTER and DROP

Summary: add a stock INT column to products.

Starter code

query.sql
-- summary alter
ALTER TABLE products

Sample solution

query.sql
ALTER TABLE products
ADD COLUMN stock INT;

Expected output

Tablo güncellendi

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Which command removes a table entirely?

  • ALTER TABLE
  • DROP TABLE Correct answer
  • DELETE FROM
  • TRUNCATE

Explanation: DROP TABLE removes a table entirely.

2 Summary - ALTER and DROP: match the terms

Term Meaning
ADD COLUMN add column
DROP COLUMN drop column
ALTER COLUMN change type
DROP TABLE drop table

All lessons in Intermediate