Queries#
Table Creation#
CREATE TABLE <table_name> (
<column_name> <type>,
...
PRIMARY KEY (<columns>)
FOREIGN KEY (<column>) REFERENCES <table>
);
Update, Delete#
<UPDATE|DELETE FROM> <table>
SET <column> = <value>
WHERE <pred>;
Retrieval Queries#
SELECT [DISTINCT] <column expr>
FROM <table>
[WHERE <pred>]
[GROUP BY <columns>]
[HAVING <pred>]
[ORDER BY <column expr> [DESC|ASC]]
[LIMIT <int>];
Order of Operation#
FROM
WHERE
SELECT
GROUP BY
HAVING
DISTINCT
ORDER BY
LIMIT