alias name ::=
identifier
atomic expr ::=
constant |
column spec
between pred ::=
scalar expr [ NOT ] BETWEEN
scalar expr AND
scalar expr
boolean expr ::=
| [ NOT ] { predicate | '('
boolean expr ')' } [ IS [ NOT ]
truth value ]
| boolean expr { AND | OR }
boolean expr
case expr ::=
CASE { WHEN boolean expr THEN
scalar expr }+ [ ELSE
scalar expr ] END
| CASE scalar expr { WHEN
scalar expr THEN
scalar expr }+ [ ELSE
scalar expr ] END
column def ::=
column name
data type [
column modifier ]* [ NOT NULL ]
column def list ::=
column def [ ','
column def ]*
column modifier ::=
FORMAT '=' <quoted or nonquoted SAS format specification>
| LABEL '=' string
column name ::= identifier
column name list ::=
column name [ [',']
column name ]*
column spec ::=
[ CALCULATED ] column name
| table alias'.'
column name
comp operator ::=
| EQ | '='
| NE | '^=' | '~=' | '!=' | '<>'
| LT | '<'
| GT | '>'
| LE | '<='
| GE | '>='
comparison pred ::=
scalar expr {
comp operator
scalar expr }+
connection string ::= <user-defined
string delimited by ending/matching parenthesis>
constant ::=
| number | missing value
| string | date/time string
| NULL
contains pred ::=
scalar expr { CONTAINS | '?' }
scalar expr
data type ::=
{ CHAR[ACTER] | VARCHAR } [ '('unsigned ')' ]
| { INT[EGER] | SMALLINT }
| { NUM[ERIC] | DEC[IMAL] | FLOAT }
[ '(' unsigned [ ',' unsigned ] ')' ]
| REAL | DOUBLE PRECISION | DATE
date/time string ::=
string{D|T|DT}
dbms options ::= <user-defined
string delimited by ending/matching parenthesis>
digit ::= '0' <through> '9'
exists pred ::= EXISTS subquery
function args ::=
scalar expr [ ',' scalar expr ]* | DISTINCT scalar expr | [ DISTINCT ] '*'
function expr ::=
func name '('
function args ')'
function name ::=
identifier
identifier ::= ['\']{
letter|<underscore>}{
letter|
digit|<underscore>}*
in pred ::=
scalar expr { [ NOT ] IN | NOTIN } {
subquery | '('
constant [ ','
constant ]* ')' }
index name ::=
identifier
insert set list ::= SET
set value list [ SET
set value list ]*
insert source ::=
| insert values list
| insert set list
| query expr
insert value ::= VALUES '('
scalar expr [ ','
scalar expr ]* ')'
insert values list ::=
insert value [
insert value ]*
letter ::= 'a' <through> 'z' <or> 'A' <through> 'Z'
libref name ::=
identifier
like pred ::=
scalar expr [ NOT ] LIKE
scalar expr
missing value ::= '.'[
letter]
null pred ::=
scalar expr IS [ NOT ] { NULL | MISSING }
number ::=
{unsigned|{
digit}+'.'[{
digit}+]|'.'{
digit}+}[{'e'|'E'}['+'|'-']{
digit}+]
order by clause ::=
ORDER BY atomic expr [ ASC | DESC ] [ ','
atomic expr [ ASC | DESC ] ]*
Pass-Through
Specification
passthru spec ::=
<database-specific string delimited by ending/matching parenthesis>
predicate ::=
| comparison pred
| between pred
| in pred
| like pred
| null pred
| quantified comparison pred
| exists pred
| contains pred
| soundslike pred
Quantified
Comparison Predicate
quantified comparison pred ::=
scalar expr
comp operator { ALL | SOME | ANY }
subquery
query expr ::=
query spec
| query expr { [ OUTER ] UNION | EXCEPT | INTERSECT } [ CORRESPONDING ] [ ALL ]
query expr
query spec ::=
SELECT [ DISTINCT | UNIQUE ] select item [ ','
select item ]*
FROM table ref [ ','
table ref ]*
[ WHERE boolean expr ]
[ GROUP BY scalar expr [ ','
scalar expr ]* ]
[ HAVING boolean expr ]
scalar expr ::=
| atomic expr
| function expr
| '(' scalar expr ')'
| subquery
| scalar expr { '+' | '-' | '*' | '/' | '||' | '**' }
scalar expr
| { '+' | '-' } scalar expr
| case expr
select item ::=
'*'
| identifier'.*'
| scalar expr [ [ AS ]
identifier ] [
column modifier ]*
select spec ::=
query expr [
order by clause ]
set value list ::=
column name '='
scalar expr [ ','
column name '='
scalar expr ]*
soundslike pred ::=
scalar expr '=*'
scalar expr
string ::=
<a single- or double-quoted
literal string -- see Strings>
subquery ::= '('
query expr
table alias ::=
identifier
table join ::=
table ref [ INNER | { LEFT | RIGHT | FULL }
[ OUTER ] ] JOIN table ref
{ ON boolean expr | USING '('
column name list ')' }
| '(' table join ')'
table name ::=
identifier
table options ::= <user-defined
string delimited by ending/matching bracket>
table ref ::=
table spec [ [ AS ]
identifier ]
| subquery [ [ AS ]
identifier ] [ '('
column name list ')' ]
| CONNECTION TO identifier '('
connection string ')' [ [ AS ]
identifier ]
| table join
table spec ::=
| table name [ '['
table options ']' ]
| libref name'.'
table name [ '['
table options ']' ]
truth value ::= { TRUE | YES } | { FALSE | NO }
where clause ::= WHERE
boolean expr
with index spec ::= [ UNIQUE ] INDEX
index name ON '('
column name list ')'