SQL // cheat sheet

-- Percy Jackson & The Great Hyrule Database

SELECT Read data from a table

Fetches rows from a table. Use * for all columns, or list specific ones.

SELECT name, courage FROM heroes; SELECT * FROM shrines;
WHERE Filter rows by condition

Narrows results. Combine with =, >, <, !=, or AND / OR.

SELECT * FROM heroes WHERE defeated = false; SELECT * FROM weapons WHERE durability > 50;
ORDER BY Sort results

ASC = smallest first (A→Z). DESC = largest first (Z→A).

SELECT * FROM heroes ORDER BY courage DESC; SELECT * FROM shrines ORDER BY region ASC;
INSERT INTO Add a new row

Columns and values must match in order. Text values go in single quotes.

INSERT INTO heroes (name, skill) VALUES ('Nico', 80);
UPDATE … SET Change existing data

Always use WHERE — otherwise every row gets updated.

UPDATE heroes SET skill = 100 WHERE name = 'Annabeth';

⚠ UPDATE heroes SET skill = 100; ← updates ALL rows!

DELETE Remove rows

Also always use WHERE — without it, the entire table is deleted.

DELETE FROM monsters WHERE name = 'Kronos';

⚠ DELETE FROM monsters; ← deletes EVERYTHING. Purah will cry.