Home › Data › SQL
Data

SQL

SQL is the language you use to talk to a relational database: ask for data, add it, change it, delete it.

Querying

SELECT reads rows. Pick columns, filter with WHERE, sort with ORDER BY.

SELECT name, email FROM users
WHERE active = true
ORDER BY name;

Changing data

INSERT adds, UPDATE changes, DELETE removes. Always filter an update or delete, or you change every row.

INSERT INTO users (name, email) VALUES ('Ada', '[email protected]');
UPDATE users SET active = false WHERE id = 7;

Joins

A join pulls related rows from two tables together.

SELECT orders.id, users.name
FROM orders
JOIN users ON users.id = orders.user_id;
Keep reading: The Command Line  ·  WebSockets  ·  APIs