SQL Query
- Related: Relational Algebra
# Queries

SELECT [DISTINCT] <column expression list>
FROM <single table>
[WHERE <predicate>]
[GROUP BY <column list>
[HAVING <predicate>] ]
[ORDER BY <column list>]
[LIMIT <integer>];
# Aggregate
AVG()COUNT()SUM()
# Misc
.schema.tables- SQL Null
- represents an “unknown” or “missing” value.
- If you do any calculation with NULL, you’ll just get NULL. For instance if x is NULL, then x > 3, 1 = x, and x + 4 all evaluate to NULL. Even x = NULL would evaluate to NULL
- if you want to check whether x is
NULL, then writex IS NULLorx IS NOT NULLinstead. - when the comparison involves
NULLvalues.UNKNOWN - NULL is falsey, meaning that
WHERE NULLis just likeWHERE FALSE. The row in question does not get included. NULLcolumn values are ignored by aggregate functions.- SQL Set
UNIONINTERSECTEXCEPT<ALL>: All possible value. (Allow Duplicates, Optional)
- SQL View
- SQL Common Table Expression
- SQL Testing
- Query Optimization