Skip to Content
SQL and Relational Theory, 3rd Edition
book

SQL and Relational Theory, 3rd Edition

by C.J. Date
November 2015
Intermediate to advanced
582 pages
16h 19m
English
O'Reilly Media, Inc.
Content preview from SQL and Relational Theory, 3rd Edition

Appendix D

A Tutorial D Grammar

I never use a big, big D

—W. S. Gilbert: HMS Pinafore (1878)

For purposes of reference, this appendix gives a BNF grammar for Tutorial D relational expressions and assignments. (Nonrelational operations—including aggrgegate operations in particular—are mostly omitted, as are definitional operations such as those used to define types, base relvars, views, and constraints.) The following are also omitted:

  • TUPLE FROM, because it doesn’t return a relation

  • THE_ operators and <attribute name> FROM, because these operators too don’t return relations (except in the unusual special case where the specified possrep component or attribute, as applicable, happens to be relation valued)

  • DIVIDEBY and SUMMARIZE, because (as explained in Chapter 7) these operators are both somewhat deprecated

Also, the grammar is simplified in certain respects. In particular, it makes no attempt to say where image relations can and can’t be used, nor does it pay any attention to operator precedence rules. (As a result of this latter point, certain constructs permitted by the grammar— for example, the expression r1 MINUS r2 MINUS r3—are potentially ambiguous. Additional syntax rules are needed to resolve such issues, but such rules are omitted here. Of course, parentheses can always be used to guarantee a desired order of evaluation anyway.) A few points of detail:

  • The following simplifying abbreviations are used:

    exp    for      expressionop     for      operatorcomp   for ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

SQL in a Nutshell, 3rd Edition

SQL in a Nutshell, 3rd Edition

Kevin Kline
SQL in a Nutshell, 4th Edition

SQL in a Nutshell, 4th Edition

Kevin Kline, Regina O. Obe, Leo S. Hsu

Publisher Resources

ISBN: 9781491941164Errata Page