next up previous contents
Next: DML Up: SQL Previous: Table Declarations   Contents


Queries $ Q$ are added to the rules for expressions $ e$ .

\textrm{Queries} & Q &::=& (q \; [\math...
...OM} [()] \mid \hat{E} \; [o] \mid \hat{E} \; [o], O

\textrm{Projections} & P &::=& \ast & \...
...sf{RANK}() \\
&&& \mathsf{COUNT}(*) \\
&&& a(E)

Additionally, an SQL expression may be inserted into normal Ur code with the syntax $ (\mathsf{SQL} \; E)$ or $ (\mathsf{WHERE} \; E)$ . Similar shorthands exist for other nonterminals, with the prefix $ \mathsf{FROM}$ for $ \mathsf{FROM}$ items and $ \mathsf{SELECT1}$ for pre-queries.

Unnamed expression columns in $ \mathsf{SELECT}$ clauses are assigned consecutive natural numbers, starting with 1. Any expression in a $ p$ position that is enclosed in parentheses is treated as an expression column, rather than a column pulled directly out of a table, even if it is only a field projection. (This distinction affects the record type used to describe query results.)