BNF Grammars for SQL-92, SQL-99 and SQL-2003

SQL-92

Here is a heavily hyperlinked HTML version of the BNF grammar for SQL-92 (ISO/IEC 9075:1992 - Database Language - SQL). The plain text file from which it was automatically converted is more useful (read legible) for reading without a browser.

SQL-99

Here is a heavily hyperlinked HTML version of the BNF grammar for SQL-99 (ISO/IEC 9075-2:1999 - Database Languages - SQL - Part 2: Foundation (SQL/Foundation)). The plain text file from which it was automatically converted is more useful (read legible) for reading without a browser.

SQL-2003

Here is a heavily hyperlinked HTML version of the BNF grammar for SQL-2003 (ISO/IEC 9075-2:2003 - Database Languages - SQL - Part 2: Foundation (SQL/Foundation)). The plain text file from which it was automatically converted is more useful (read legible) for reading without a browser.

There is a separate file HTML for the information from ISO/IEC 9075-1:2003 - Database Languages - SQL - Part 1: Framework (SQL/Framework). It was automatically converted from the plain text file, which is more useful (read legible) for reading without a browser.

Also available:

  • SQL 2003 Core Features
  • SQL 2003 Non-Core Features
  • Informix OUTER Join Syntax

    Here is an HTML explanation of the Informix OUTER join syntax.

    Conversion tools

    The plain text was converted to HTML by the Perl script bnf2html which you may use if you wish. The bnf2html script also uses the C program WEBCODE version 1.09 which you can download as a gzipped tar file.

    See also bnf2yacc , an experimental script to convert BNF into an outline Yacc grammar. The generated grammar typically includes some unacceptable tokens, such as %token 0, that should be handled by the lexical analyzer rather than the grammar. The SQL standard includes such rules as grammar rules.

    (The Perl scripts should normally be renamed after downloading.)

    Download

    You can download a gzipped tar file containing the raw grammars, the HTML versions of those grammars, and the conversion tools as the gzipped tar file sql-bnf.tgz .
    Please send feedback to Jonathan Leffler: jonathan.leffler@gmail.com .

    Last modified: 13th November 2017