Giter VIP home page Giter VIP logo

sql's Introduction

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

This repository contains the BNF (Backus-Naur Form) grammars for three versions of standard SQL — SQL-92, SQL-99 and SQL-2003.

You should be able to find a version of this site with 'active HTML' at:

It may not be the most recent release, but the technical content is mostly valid. The download link is not functional — you can obtain the material for the latest release from https://github.com/ronsavage/SQL/releases/latest.

** !! Syntax Rules

Regarding the text '!! See the Syntax Rules': That is literally what it says in the PDF containing the standard.

For an extract of the standard about these rules see the file 'Syntax.rules.txt'.

This project is still in transition to GitHub. The links in this README.md file lead to the pages in the GitHub source tree. Most of them will display the HTML source — not a rendered HTML image. There probably are ways around that; we're learning GitHub as we go.

For a long time, this material was hosted by Ron Savage at http://savage.net.au/SQL — many thanks, Ron! — but that site now points to here.

At the moment, the suggested method of operation is:

  • Clone this repository to your machine — e.g. into the /home/somebody/SQL directory
  • Point your browser to file:///home/somebody/SQL/index.html.

This should give you full HTML access to the material. Alternatively, you can download the latest release of this material (instead of cloning the repo), and then extract that into a directory and point your browser to the index.html file in that directory.

Yes: it is sub-optimal. Yes: we'll fix it when we know how to fix it.

SQL-92

The file sql-92.bnf.html is a heavily hyperlinked HTML version of the BNF grammar for SQL-92 (ISO/IEC 9075:1992 - Database Language - SQL).

The plain text file sql-92.bnf, from which it was automatically converted, is more useful (read legible) for reading without a browser.

SQL-99

The file sql-99.bnf.html 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 sql-99.bnf, from which it was automatically converted, is more useful (read legible) for reading without a browser.

SQL-2003

The file sql-2003-2.bnf.html 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 sql-2003-2.bnf, from which it was automatically converted, is more useful (read legible) for reading without a browser.

There is a separate file sql-2003-1.bnf.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 sql-2003-1.bnf, 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

    The file outer-joins.html is an explanation of the non-standard Informix OUTER join syntax and semantics.

    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; consequently, you won't get a clean Yacc grammar from the SQL BNF files.

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

    Download

    You should be able to get the downloadable version of the latest release of this repository from the releases area:

    SQL 2016 Released

    ISO/IEC JTC 1/SC 32 Publishes Updated SQL Database Language Standard — SQL 2016.


    Please send feedback to Jonathan Leffler ( [email protected] ) _and_ Ron Savage ( [email protected] ).

    Last modified: 13th March 2017

    sql's People

    Contributors

    gcer-hidenori avatar jleffler avatar mikeschinkel avatar ronsavage avatar whitten avatar

    Stargazers

     avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

    Watchers

     avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

    sql's Issues

    Which is collect, <overlaps predicate part 1> or <overlaps predicate part 2> ?

    I just found typo of <overlaps predicate part 1> or <overlaps predicate part 2> .
    In sql-2003-2.bnf,the below lines uses <overlaps predicate part> but no definition in BNF.
    <case operand> ::= <row value predicand> | <overlaps predicate part>
    But there is <overlaps predicate part 1>,<overlaps predicate part2> definition in BNF.
    <overlaps predicate part 1> ::= <row value predicand 1>

    <overlaps predicate part 2> ::= OVERLAPS <row value predicand 2>

    Which is collect, <multset value expression> or <multiset value expression>

    I just found typo of <multset value expression> or <multiset value expression> .
    In sql-2003-2.bnf,the below lines uses <multset value expression> but no definition in BNF.
    <multiset element reference> ::=
    ELEMENT <left paren> <multset value expression> <right paren>

    But there is <multiset value expression> definition in BNF.
    <multiset value expression> ::=
    <multiset term>
    | <multiset value expression> MULTISET UNION [ ALL | DISTINCT ] <multiset term>
    | <multiset value expression> MULTISET EXCEPT [ ALL | DISTINCT ] <multiset term>

    syntax rules

    The document sql-2003-2.bnf.html and many other documents on the web contain !! See Syntax Rules, but I'm not able to find them. Where do I find the definition of these rules?

    Does <single datetime field> in SQL92.bnf have an errant <left paren>?

    Does your <single datetime field> in your SQL92.bnf file have an extra <left paren> that it should not have?

    This line in your BNF has the following (I wrapped it so that it would not create a horizontal scroll in the issue):

    |  SECOND [ <left paren> <interval leading field precision> 
       [ <comma> <left paren> <interval fractional seconds precision> ] <right paren> ]
    

    However, the equivalent line for SQL99 has the following:

    | SECOND [ <left paren> <interval leading field precision> 
       [ <comma> <interval fractional seconds precision> ] <right paren> ]   
    

    Can I assume the <left paren> that comes after the <comma> is an error in your SQL92 file?

    I'll be happy to create a pull request if you confirm that it is an error and I am understanding correctly what it should be.

    [typo]typo for module collations

    At line 4472 of sql-2003-2.bnf,<module collation> may be typo for <module collations>.

    <SQL-client module definition> ::=
    		<module name clause> <language clause> <module authorization clause>
    		[ <module path specification> ]
    		[ <module transform group specification> ]
    		[ <module collation> ]
    		~~~~~~here~~~~~~~~~~~~~~~~
    		[ <temporary table declaration>... ]
    		<module contents>...
    

    At line 4487 of sql-2003-2.bnf,<module collations> is defined,but <module collation> is not found.

    <module collations> ::= <module collation specification>...
    

    unclosed h2 tags --

    Starting at line 5330 of sql-2003-2.bnf (the plaintext one), there are a few unclosed "--h2" tags. (would expect to see a --/h2 for each)

    Which is collect, <module collation> or <module collations> ?

    I just found typo of <module collation> or <module collations> .

    In sql-2003-2.bnf,the below lines uses <module collation> but no definition in BNF.
    <SQL-client module definition> ::=
    <module name clause> <language clause> <module authorization clause>
    [ <module path specification> ]
    [ <module transform group specification> ]
    [ <module collation> ]
    [ <temporary table declaration>... ]
    <module contents>...

    But there is <module collations> definition in BNF.
    <module collations> ::= <module collation specification>...

    asterisk

    Hi all,
    at sql-2003-2.bnf.html#select list:

    <select list> ::= <asterisk> | <select sublist> [ { <comma> <select sublist> }... ]
    mean <asterisk> **or** <select sublist> [ { <comma> <select sublist> }... ]
    but SQL accept :
    <select list> ::= <asterisk> | <asterisk> <select sublist> [ { <comma> <select sublist> }... ]
    regards

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. 📊📈🎉

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google ❤️ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.