SQL Expressions
Table of contents
Before you begin
identifier
FeatureBase identifiers (including object names such as databases, tables and columns) start with a lower-case alphabetic character and can include:
- lower-case alphabetic characters
- numbers 0-9
- dash
-
and underscore _
characters.
expr
Syntax | Example | Result |
expr [NOT] LIKE expr | SELECT * FROM products WHERE prodlist LIKE 'pen'; | ballpen , pencil , playpen |
expr IS [NOT] null | SELECT * FROM services WHERE price IS null; | free delivery on orders over $50 |
expr [NOT] between expr AND expr | SELECT * from Products WHERE Price BETWEEN 10 AND 20; | fountain pen , notepad , rubber ball |
expr [NOT] IN ([SELECT_stmnt | expr,...]) | Select * from Products where product_ID NOT IN (SELECT product_ID from Sales where product_name LIKE ear) | gold-plated earplugs |
Literals
Literals are explicitly specified fixed values that conform to a specific data type:
[unary_op] expr
expr binary_op expr
function_call
CAST <expr>
AS <data-type>
Syntax | Example | Result | Additional information |
CAST <expr> AS <data-type> | SELECT CAST (25.65 AS int); | 25 | CAST function |
paren_select_stmt
BNF diagram | Description | Additional information |
| A SQL Statement nested within another SQL statement | SELECT Statement |
case_expr