DROP TABLE and ALTER TABLE
DROP TABLE deletes a table and all its data. TRUNCATE (not in SQLite) empties it quickly. ALTER TABLE changes the structure: ADD COLUMN, RENAME TO, and in most databases DROP COLUMN and change a column type.
Example
CREATE TABLE notes (id INTEGER, text TEXT);
ALTER TABLE notes ADD COLUMN created TEXT;
ALTER TABLE notes RENAME TO memos;
INSERT INTO memos (id, text, created) VALUES (1, 'Hi', '2026-05-01');
SELECT * FROM memos;Result
id | text | created 1 | Hi | 2026-05-01
- In MySQL and PostgreSQL you can also change a column with ALTER COLUMN or MODIFY. SQL Server uses ALTER COLUMN.
Exercise
Add a column to a table.
ALTER TABLE notes COLUMN created TEXT;
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.