INSERT, UPDATE and DELETE
INSERT adds a row. Always list the column names so the order cannot get mixed up:
SQL
INSERT INTO customers (customer_id, name, city, country, signup_date) VALUES (11, 'Taif Roses Co', 'Taif', 'Saudi Arabia', '2024-09-01'); SELECT * FROM customers WHERE customer_id = 11;
UPDATE changes existing values. DELETE removes rows.
SQL
UPDATE products SET stock = stock - 5 WHERE product_id = 1; SELECT name, stock FROM products WHERE product_id = 1;
Watch outThe most important tip in SQL: never write UPDATE or DELETE without WHERE. Without it, the change hits every row. Run a SELECT with the same condition first.
The editor here is safe: undo any change with the “Reset data” button.