SQL
Selecting Data
Select specific columns:
SELECT column, other column
FROM table;
Select all columns:
SELECT *
FROM table;
Constraints
Select columns according to certain conditions, such as:
- numerical operators (
=
,<
, etc.) - ranges (
BETWEEN x AND y
) - lists (
IN
orNOT IN
)
SELECT *
FROM table
WHERE {condition};
For example:
SELECT *
FROM table
WHERE column <= 2.5;
Sorting
SELECT DISTINCT *
FROM table
WHERE condition(s)
ORDER BY column ASC/DESC
LIMIT num_limit OFFSET num_offset;
Joins
Types:
- INNER JOIN
- LEFT OUTER JOIN
- RIGHT OUTER JOIN
- FULL OUTER JOIN
TODO