Now on Omarchy: read the manual without leaving your desktop

Cheat Sheet

The commands you keep forgetting, with a one-line description and a real example you can copy - 629 across 38 tools. Pick a tool in the sidebar, or search across all of them.

Showing SQL. Choose another tool in the sidebar, or search all 629 commands.

SQL

The core queries for reading and changing relational data.

17 commands
CommandWhat it doesExample
SELECTRead columns from a table.SELECT id, name FROM users;
WHEREFilter rows by a condition.SELECT * FROM users WHERE age >= 18;
ORDER BYSort the results.SELECT * FROM users ORDER BY created_at DESC;
LIMITReturn at most N rows.SELECT * FROM users LIMIT 10;
INSERTAdd a new row.INSERT INTO users (name, email) VALUES ('Ana', '[email protected]');
UPDATEChange existing rows (always with WHERE).UPDATE users SET active = true WHERE id = 5;
DELETERemove rows (always with WHERE).DELETE FROM users WHERE id = 5;
INNER JOINCombine rows that match in both tables.SELECT * FROM orders o JOIN users u ON u.id = o.user_id;
LEFT JOINKeep all left rows, match where possible.SELECT u.name, o.id FROM users u LEFT JOIN orders o ON o.user_id = u.id;
GROUP BYCollapse rows into groups for aggregates.SELECT user_id, COUNT(*) FROM orders GROUP BY user_id;
HAVINGFilter groups after aggregation.SELECT user_id, COUNT(*) FROM orders GROUP BY user_id HAVING COUNT(*) > 3;
COUNT / AVGAggregate over rows.SELECT AVG(total) FROM orders;
DISTINCTReturn only unique values.SELECT DISTINCT country FROM users;
LIKEMatch a text pattern (% = any run).SELECT * FROM users WHERE email LIKE '%@gmail.com';
CREATE TABLEDefine a new table.CREATE TABLE tags (id SERIAL PRIMARY KEY, name TEXT NOT NULL);
ALTER TABLEAdd or change a column.ALTER TABLE users ADD COLUMN phone TEXT;
CREATE INDEXSpeed up lookups on a column.CREATE INDEX idx_users_email ON users (email);