For purposes of reference, it seems appropriate to close this chapter, and the main part of this book, with a simplified BNF grammar for SQL table expressions and SQL boolean expressions. The grammar is deliberately somewhat conservative, in that it fails to define as valid certain expressions that are so, according to the SQL standard. (However, I don’t believe it defines as valid any expressions that aren’t so according to that standard.) To be more specific, constructs that I’ve previously advised you not to use—including in particular everything to do with nulls and 3VL—are deliberately omitted; so too are certain somewhat esoteric features (e.g., recursive queries). Also, for reasons explained in Chapter 1, almost all of the syntactic categories in what follows have names that differ from their counterparts in the standard. The following simplifying abbreviations are used:
All syntactic categories of the form <... name> are assumed to be <identifier>s and are defined no further here. The category <scalar exp> is also left undefined—though it might help to recall in particular that:
A scalar subquery is a legal scalar expression.
Most “row expressions” that occur in practice are actually scalar expressions.
Boolean expressions are scalar expressions too.
As you can see, the grammar in this subsection begins with a production for <with exp>, a construct not mentioned (as such) in the body of the ...