Use * to SELECT all records.
SELECT individual columns.
DISTINCT will return all unique entries. The column name could also be placed in parentheses.
COUNT will return the number of rows that match a condition.
WHERE allows you to specify conditions.
| Comparison Operators | Description |
|---|---|
| = | Equal |
| > | Greater Than |
| < | Less Than |
| >= | Greater Than or Equal To |
| <= | Less Than or Equal To |
| <> or != | Not Equal To |
Logical Operators
AND, OR, NOT
ORDER BY will sort the results. The default order is ascending ASC, but descending can also be specified DESC.
LIMIT will restrict the row output to a specified number.
BETWEEN will return results that match a range of values (inclusive). It is the same as >= low AND <= high. To find values outside of the range NOT BETWEEN can be used.
Note: A datetime starts at 0:00, so the high value would need to be the required day + 1.
IN replaces multiple OR statements.
LIKE (case-sensitive) and ILIKE allow you to match patterns in a string.
The wildcard character % will match any sequence of characters and the wildcard character _ will match any single character.