Terminology

Operators

Operators are used to compare values. The following table from wikipedia shows the SQL operators.

SQL Operators
Operator Description Example

=

Equal to

value = 'MyString'

<>/!=

Not equal

value != 'MyString'

>

Greater than

value > 4

<

Less than

value < 4

>=

Greater than or equal to

value >= 4

Less than or equal to

value ⇐ 4

[NOT] BETWEEN

Between an inclusive range. Or not between an inclusive range if NOT BETWEEN.

value BETWEEN 1 AND 10 or value NOT BETWEEN 1 AND 10

[NOT] IN

Equal to one of many possible values. Or not equal to one of many possible values.

value IN (1, 2, 3) or value NOT IN (1, 2, 3)

IS [NOT] NULL

Compare to NULL.

value IS NULL or value IS NOT NULL

IS [NOT] TRUE/FALSE

Compare to TRUE or FALSE

value IS TRUE or value IS FALSE or value IS NOT TRUE or value IS NOT FALSE

IS NOT DISTINCT FROM

Is equal to value or both are NULL

value IS NOT DISTINCT FROM other_value

AS

Used to change column name when viewing results

SELECT abs_val AS 'Absolute value' FROM results;

Predicates

Predicates are conditions that are evaluated into true or false. For example, the furry = TRUE and has_claws = FALSE portions of the following query evaluates to true.

SELECT * FROM pets WHERE furry = TRUE OR has_claws = FALSE;

Clauses

WHERE, ORDER BY, GROUP BY, HAVING, FROM, TOP/LIMIT, OFFSET

Identifiers

Identifiers are names of database objects, like tables, columns, etc.

Statements

Statements are text sent to a database engine. Typically, statements begin with one of the following keywords, and end in a semi-colon.

SELECT, SELECT DISTINCT, SELECT INTO, INSERT INTO, UPDATE, DELETE

Queries

A query is any statement that returns rows. That means, typically, statements that start with the the following keywords.

SELECT, SELECT DISTINCT