Lesson 12: INSERT, UPDATE & DELETE

13 Jul 2026 1 min Swarnil Singhai

These three statements are how data changes — inserting new rows, updating existing ones, and removing rows that no longer belong.

Real-time example

A customer changes their email, and an old cancelled order gets removed from an active-orders view table.

INSERT INTO customers (name, email) VALUES ('Amit Shah', 'amit@example.com');

UPDATE customers SET email = 'amit.new@example.com' WHERE id = 1;

DELETE FROM orders WHERE status = 'CANCELLED' AND created_at < '2025-01-01';

What's happening

UPDATE and DELETE without a WHERE clause affect every single row in the table — one of the most common and costly SQL mistakes.

Always run the equivalent SELECT with the same WHERE clause first to confirm exactly which rows will be affected.

Advertisement