Derived from file sql-92.bnf version 2.5 dated 2017/01/17 01:05:03
Generated on 2017-11-14 06:53:25+00:00 by file bnf2html.pl version 3.16 dated 2017/11/14 06:53:22
Using Appendix G of "Understanding the New SQL: A Complete Guide" by J Melton and A R Simon (Morgan Kaufmann, 1993, ISBN 0-55860-245-3) as the source of the syntax, here is (most of) the BNF syntax for SQL-92. The missing parts are the Cobol, Fortran, MUMPS, Pascal and PL/I variable definition rules.
The plain text version of this grammar is sql-92.bnf .
<SQL terminal character> ::=
<SQL language character>
| <SQL embedded language character>
<SQL language character> ::=
<simple Latin letter>
| <digit>
| <SQL special character>
<simple Latin letter> ::=
<simple Latin upper case letter>
| <simple Latin lower case letter>
<simple Latin upper case letter> ::=
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
<simple Latin lower case letter> ::=
a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | y | z
<digit> ::=
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
<SQL special character> ::=
<space>
| <double quote>
| <percent>
| <ampersand>
| <quote>
| <left paren>
| <right paren>
| <asterisk>
| <plus sign>
| <comma>
| <minus sign>
| <period>
| <solidus>
| <colon>
| <semicolon>
| <less than operator>
| <greater than operator>
| <equals operator>
| <question mark>
| <underscore>
| <vertical bar>
<space> ::= !! space character in character set in use
<double quote> ::= "
<percent> ::= %
<ampersand> ::= &
<quote> ::= '
<left paren> ::= (
<right paren> ::= )
<asterisk> ::= *
<plus sign> ::= +
<comma> ::= ,
<minus sign> ::= -
<period> ::= .
<solidus> ::= /
<colon> ::= :
<semicolon> ::= ;
<less than operator> ::= <
<equals operator> ::= =
<greater than operator> ::= >
<question mark> ::= ?
<underscore> ::= _
<vertical bar> ::= |
<left bracket> | <right bracket>
<left bracket> ::= [
<right bracket> ::= ]
<token> ::=
<nondelimiter token>
| <delimiter token>
<nondelimiter token> ::=
<regular identifier>
| <key word>
| <unsigned numeric literal>
| <national character string literal>
| <bit string literal>
| <hex string literal>
<identifier start> [ { <underscore> | <identifier part> } ... ]
<identifier start> ::= !! See the Syntax rules
<reserved word> | <non-reserved word>
<reserved word> ::=
ABSOLUTE | ACTION | ADD | ALL | ALLOCATE | ALTER | AND | ANY | ARE
| AS | ASC | ASSERTION | AT | AUTHORIZATION | AVG
| BEGIN | BETWEEN | BIT | BIT_LENGTH | BOTH | BY
| CASCADE | CASCADED | CASE | CAST | CATALOG | CHAR | CHARACTER | CHARACTER_LENGTH
| CHAR_LENGTH | CHECK | CLOSE | COALESCE | COLLATE | COLLATION | COLUMN | COMMIT
| CONNECT | CONNECTION | CONSTRAINT | CONSTRAINTS | CONTINUE | CONVERT | CORRESPONDING
| CREATE | CROSS | CURRENT | CURRENT_DATE | CURRENT_TIME | CURRENT_TIMESTAMP | CURRENT_USER | CURSOR
| DATE | DAY | DEALLOCATE | DEC | DECIMAL | DECLARE | DEFAULT
| DEFERRABLE | DEFERRED | DELETE | DESC | DESCRIBE | DESCRIPTOR | DIAGNOSTICS
| DISCONNECT | DISTINCT | DOMAIN | DOUBLE | DROP
| ELSE | END | END-EXEC | ESCAPE | EXCEPT | EXCEPTION | EXEC | EXECUTE | EXISTS | EXTERNAL | EXTRACT
| FALSE | FETCH | FIRST | FLOAT | FOR | FOREIGN | FOUND | FROM | FULL
| GET | GLOBAL | GO | GOTO | GRANT | GROUP
| HAVING | HOUR
| IDENTITY | IMMEDIATE | IN | INDICATOR | INITIALLY | INNER | INPUT | INSENSITIVE
| INSERT | INT | INTEGER | INTERSECT | INTERVAL | INTO | IS | ISOLATION
| JOIN
| KEY
| LANGUAGE | LAST | LEADING | LEFT | LEVEL | LIKE | LOCAL | LOWER
| MATCH | MAX | MIN | MINUTE | MODULE | MONTH
| NAMES | NATIONAL | NATURAL | NCHAR | NEXT | NO | NOT | NULL | NULLIF | NUMERIC
| OCTET_LENGTH | OF | ON | ONLY | OPEN | OPTION | OR | ORDER | OUTER | OUTPUT | OVERLAPS
| PAD | PARTIAL | POSITION | PRECISION | PREPARE | PRESERVE | PRIMARY | PRIOR | PRIVILEGES | PROCEDURE | PUBLIC
| READ | REAL | REFERENCES | RELATIVE | RESTRICT | REVOKE | RIGHT | ROLLBACK | ROWS
| SCHEMA | SCROLL | SECOND | SECTION | SELECT | SESSION | SESSION_USER | SET
| SIZE | SMALLINT | SOME | SPACE | SQL | SQLCODE | SQLERROR | SQLSTATE | SUBSTRING | SUM | SYSTEM_USER
| TABLE | TEMPORARY | THEN | TIME | TIMESTAMP | TIMEZONE_HOUR | TIMEZONE_MINUTE
| TO | TRAILING | TRANSACTION | TRANSLATE | TRANSLATION | TRIM | TRUE
| UNION | UNIQUE | UNKNOWN | UPDATE | UPPER | USAGE | USER | USING
| VALUE | VALUES | VARCHAR | VARYING | VIEW
| WHEN | WHENEVER | WHERE | WITH | WORK | WRITE
| YEAR
| ZONE
<non-reserved word> ::=
ADA
| C | CATALOG_NAME | CHARACTER_SET_CATALOG | CHARACTER_SET_NAME | CHARACTER_SET_SCHEMA
| CLASS_ORIGIN | COBOL | COLLATION_CATALOG | COLLATION_NAME | COLLATION_SCHEMA
| COLUMN_NAME | COMMAND_FUNCTION | COMMITTED | CONDITION_NUMBER | CONNECTION_NAME
| CONSTRAINT_CATALOG | CONSTRAINT_NAME | CONSTRAINT_SCHEMA | CURSOR_NAME
| DATA | DATETIME_INTERVAL_CODE | DATETIME_INTERVAL_PRECISION | DYNAMIC_FUNCTION
| FORTRAN
| LENGTH
| MESSAGE_LENGTH | MESSAGE_OCTET_LENGTH | MESSAGE_TEXT | MORE | MUMPS
| NAME | NULLABLE | NUMBER
| PASCAL | PLI
| REPEATABLE | RETURNED_LENGTH | RETURNED_OCTET_LENGTH | RETURNED_SQLSTATE | ROW_COUNT
| SCALE | SCHEMA_NAME | SERIALIZABLE | SERVER_NAME | SUBCLASS_ORIGIN
| TABLE_NAME | TYPE
| UNCOMMITTED | UNNAMED
<unsigned numeric literal> ::=
<exact numeric literal>
| <approximate numeric literal>
<exact numeric literal> ::=
<unsigned integer> [ <period> [ <unsigned integer> ] ]
| <period> <unsigned integer>
<digit> ...
<approximate numeric literal> ::=
<mantissa> <exponent>
<national character string literal> ::=
<quote> [ <character representation> ... ] <quote> [ { <separator> ... <quote> [ <character representation> ... ] <quote> }... ]
<nonquote character> | <quote symbol>
<nonquote character> ::= !! See the Syntax rules
<comment> | <space> | <newline> }...
<comment introducer> [ <comment character> ... ] <newline>
<minus sign> <minus sign> [<minus sign >...]
<nonquote character> | <quote>
<newline> ::= !! implementation defined end of line indicator
<bit string literal> ::=
<quote> [ <bit> ... ] <quote> [ { <separator> ... <quote> [ <bit> ... ] <quote> }... ]
<hex string literal> ::=
<quote> [ <hexit> ... ] <quote> [ { <separator> ... <quote> [ <hexit> ... ] <quote> }... ]
<digit> | A | B | C | D | E | F | a | b | c | d | e | f
<delimiter token> ::=
<character string literal>
| <date string>
| <time string>
| <timestamp string>
| <delimited identifier>
| <SQL special character>
| <not equals operator>
| <greater than or equals operator>
| <less than or equals operator>
| <concatenation operator>
| <double period>
| <left bracket>
| <right bracket>
<character string literal> ::=
[ <introducer> <character set specification> ] <quote> [ <character representation> ... ] <quote> [ { <separator> ... <quote> [ <character representation> ... ] <quote> }... ]
<character set specification> ::=
<standard character repertoire name>
| <implementation-defined character repertoire name>
| <user-defined character repertoire name>
| <standard universal character form-of-use name>
| <implementation-defined universal character form-of-use name>
<schema name> <period> ] <SQL language identifier>
<catalog name> <period> ] <unqualified schema name>
<introducer> <character set specification> ] <actual identifier>
<regular identifier> | <delimited identifier>
<double quote> <delimited identifier body> <double quote>
<delimited identifier part> ...
<nondoublequote character> | <doublequote symbol>
<nondoublequote character> ::= !! See the syntax rules
<SQL language identifier> ::=
<SQL language identifier start> [ { <underscore> | <SQL language identifier part> }... ]
<simple Latin letter> | <digit>
<years value> <minus sign> <months value> <minus sign> <days value>
<quote> <time value> [ <time zone interval> ] <quote>
<hours value> <colon> <minutes value> <colon> <seconds value>
<seconds integer value> [ <period> [ <seconds fraction> ] ]
<sign> <hours value> <colon> <minutes value>
<quote> <date value> <space> <time value> [ <time zone interval> ] <quote>
<quote> { <year-month literal> | <day-time literal> } <quote>
<year-month literal> ::=
<years value>
| [ <years value> <minus sign> ] <months value>
<day-time interval> | <time interval>
<day-time interval> ::=
<days value> [ <space> <hours value> [ <colon> <minutes value> [ <colon> <seconds value> ] ] ]
<time-interval> ::=
<hours value> [ <colon> <minutes value> [ <colon> <seconds value> ] ]
| <minutes value> [ <colon> <seconds value> ]
| <seconds value>
<not equals operator> ::= <>
<greater than or equals operator> ::= >=
<less than or equals operator> ::= <=
<concatenation operator> ::= ||
<double period> ::= ..
<module> ::=
<module name clause> <language clause> <module authorization clause>
[ <temporary table declaration> ... ]
<module contents> ...
<module name clause> ::=
<module name> ] [ <module character set specification> ]
<language name> ::= ADA | C | COBOL | FORTRAN | MUMPS | PASCAL | PLI
<module authorization clause> ::=
<schema name>
| <module authorization identifier>
| <schema name> <module authorization identifier>
<temporary table declaration> ::=
<qualified local table name> <table element list> [ ON COMMIT { PRESERVE | DELETE } ROWS ]
<left paren> <table element> [ { <comma> <table element> }... ] <right paren>
<column definition> | <table constraint definition>
<column definition> ::=
<column name> { <data type> | <domain name> } [ <default clause> ] [ <column constraint definition> ... ] [ <collate clause> ]
<data type> ::=
<character string type> [ <character set specification> ]
| <national character string type>
| <bit string type>
| <numeric type>
| <datetime type>
| <interval type>
<character string type> ::=
<left paren> <length> <right paren> ]
| <left paren> <length> <right paren> ]
| <left paren> <length> <right paren> ]
| <left paren> <length> <right paren> ]
| <left paren> <length> <right paren> ]
<national character string type> ::=
<left paren> <length> <right paren> ]
| <left paren> <length> <right paren> ]
| <left paren> <length> <right paren> ]
| <left paren> <length> <right paren> ]
| <left paren> <length> <right paren> ]
| <left paren> <length> <right paren> ]
<bit string type> ::=
<left paren> <length> <right paren> ]
| <left paren> <length> <right paren> ]
<numeric type> ::=
<exact numeric type>
| <approximate numeric type>
<exact numeric type> ::=
<left paren> <precision> [ <comma> <scale> ] <right paren> ]
| <left paren> <precision> [ <comma> <scale> ] <right paren> ]
| <left paren> <precision> [ <comma> <scale> ] <right paren> ]
| INTEGER
| INT
| SMALLINT
<approximate numeric type> ::=
<left paren> <precision> <right paren> ]
| REAL
| DOUBLE PRECISION
<datetime type> ::=
<left paren> <time precision> <right paren> ] [ <left paren> <timestamp precision> <right paren> ] [ WITH TIME ZONE ]
<time fractional seconds precision>
<time fractional seconds precision>
<interval qualifier> ::=
<start field> <end field>
| <single datetime field>
<start field> ::=
<non-second datetime field> [ <left paren> <interval leading field precision> <right paren> ]
<non-second datetime field> ::= YEAR | MONTH | DAY | HOUR | MINUTE
<end field> ::=
<non-second datetime field>
| <left paren> <interval fractional seconds precision> <right paren> ]
<single datetime field> ::=
<non-second datetime field> [ <left paren> <interval leading field precision> <right paren> ]
| <left paren> <interval leading field precision> [ <comma> <left paren> <interval fractional seconds precision> ] <right paren> ]
<schema name> <period> ] <qualified identifier>
<default option> ::=
<literal>
| <datetime value function>
| USER
| CURRENT_USER
| SESSION_USER
| SYSTEM_USER
| NULL
<signed numeric literal> | <general literal>
<sign> ] <unsigned numeric literal>
<general literal> ::=
<character string literal>
| <national character string literal>
| <bit string literal>
| <hex string literal>
| <datetime literal>
| <interval literal>
<datetime literal> ::=
<date literal>
| <time literal>
| <timestamp literal>
<sign> ] <interval string> <interval qualifier>
<datetime value function> ::=
<current date value function>
| <current time value function>
| <current timestamp value function>
<current date value function> ::= CURRENT_DATE
<left paren> <time precision> <right paren> ]
<left paren> <timestamp precision> <right paren> ]
<column constraint definition> ::=
[ <constraint name definition> ] <column constraint> [ <constraint attributes> ]
<column constraint> ::=
<unique specification>
| <references specification>
| <check constraint definition>
<unique specification> ::= UNIQUE | PRIMARY KEY
<references specification> ::=
<referenced table and columns> [ <match type> ] [ <referential triggered action> ]
<table name> [ <left paren> <reference column list> <right paren> ]
<qualified name> | <qualified local table name>
<column name> [ { <comma> <column name> }... ]
<match type> ::= FULL | PARTIAL
<referential triggered action> ::=
<update rule> [ <delete rule> ]
| <delete rule> [ <update rule> ]
<referential action> ::= CASCADE | SET NULL | SET DEFAULT | NO ACTION
<left paren> <search condition> <right paren>
<search condition> ::=
<boolean term>
| <search condition> <boolean term>
<boolean term> ::=
<boolean factor>
| <boolean term> <boolean factor>
<boolean primary> [ <truth value> ]
<predicate> | <left paren> <search condition> <right paren>
<predicate> ::=
<comparison predicate>
| <between predicate>
| <in predicate>
| <like predicate>
| <null predicate>
| <quantified comparison predicate>
| <exists predicate>
| <match predicate>
| <overlaps predicate>
<row value constructor> <comp op> <row value constructor>
<row value constructor> ::=
<row value constructor element>
| <left paren> <row value constructor list> <right paren>
| <row subquery>
<row value constructor element> ::=
<value expression>
| <null specification>
| <default specification>
<value expression> ::=
<numeric value expression>
| <string value expression>
| <datetime value expression>
| <interval value expression>
<numeric value expression> ::=
<term>
| <numeric value expression> <plus sign> <term>
| <numeric value expression> <minus sign> <term>
<term> ::=
<factor>
| <term> <asterisk> <factor>
| <term> <solidus> <factor>
<value expression primary> | <numeric value function>
<value expression primary> ::=
<unsigned value specification>
| <column reference>
| <set function specification>
| <scalar subquery>
| <case expression>
| <left paren> <value expression> <right paren>
| <cast specification>
<unsigned literal> | <general value specification>
<unsigned numeric literal> | <general literal>
<general value specification> ::=
<parameter specification>
| <dynamic parameter specification>
| <variable specification>
| USER
| CURRENT_USER
| SESSION_USER
| SYSTEM_USER
| VALUE
<parameter name> [ <indicator parameter> ]
<embedded variable name> [ <indicator variable> ]
<host identifier> ::=
<Ada host identifier>
| <C host identifier>
| <Cobol host identifier>
| <Fortran host identifier>
| <MUMPS host identifier>
| <Pascal host identifier>
| <PL/I host identifier>
<Ada host identifier> ::= !! See syntax rules
<C host identifier> ::= !! See syntax rules
<Cobol host identifier> ::= !! See syntax rules
<Fortran host identifier> ::= !! See syntax rules
<MUMPS host identifier> ::= !! See syntax rules
<Pascal host identifier> ::= !! See syntax rules
<PL/I host identifier> ::= !! See syntax rules
<qualifier> <period> ] <column name>
<table name> | <correlation name>
<set function specification> ::=
<left paren> <asterisk> <right paren>
| <general set function>
<general set function> ::=
<set function type> <left paren> [ <set quantifier> ] <value expression> <right paren>
<set function type> ::= AVG | MAX | MIN | SUM | COUNT
<set quantifier> ::= DISTINCT | ALL
<left paren> <query expression> <right paren>
<non-join query expression> | <joined table>
<non-join query expression> ::=
<non-join query term>
| <query expression> <corresponding spec> ] <query term>
| <query expression> <corresponding spec> ] <query term>
<non-join query term> ::=
<non-join query primary>
| <query term> <corresponding spec> ] <query primary>
<simple table> | <left paren> <non-join query expression> <right paren>
<simple table> ::=
<query specification>
| <table value constructor>
| <explicit table>
<query specification> ::=
<set quantifier> ] <select list> <table expression>
<select list> ::=
<asterisk>
| <select sublist> [ { <comma> <select sublist> }... ]
<derived column> | <qualifier> <period> <asterisk>
<value expression> [ <as clause> ]
<table expression> ::=
<from clause>
[ <where clause> ]
[ <group by clause> ]
[ <having clause> ]
<table reference> [ { <comma> <table reference> }... ] Note that <correlation specification> does not appear in the ISO/IEC grammar. The notation is written out longhand several times, instead.
<table reference> ::=
<table name> [ <correlation specification> ]
| <derived table> <correlation specification>
| <joined table>
<correlation specification> ::=
[ <correlation name> [ <left paren> <derived column list> <right paren> ]
<joined table> ::=
<cross join>
| <qualified join>
| <left paren> <joined table> <right paren>
<cross join> ::=
<table reference> <table reference>
<qualified join> ::=
<table reference> [ <join type> ] <table reference> [ <join specification> ]
<join type> ::=
<outer join type> [ OUTER ]
| UNION
<outer join type> ::= LEFT | RIGHT | FULL
<join condition> | <named columns join>
<left paren> <join column list> <right paren>
<grouping column reference list>
<grouping column reference list> ::=
<grouping column reference> [ { <comma> <grouping column reference> }... ]
<column reference> [ <collate clause> ]
<table value constructor list>
<row value constructor> [ { <comma> <row value constructor> }... ]
<non-join query term> | <joined table>
<left paren> <corresponding column list> <right paren> ]
<non-join query primary> | <joined table>
<case abbreviation> | <case specification>
<case abbreviation> ::=
<left paren> <value expression> <comma> <value expression> <right paren>
| <left paren> <value expression> { <comma> <value expression> }... <right paren>
<simple case> | <searched case>
<simple case> ::=
<case operand>
<simple when clause> ...
[ <else clause> ]
END
<searched case> ::=
<searched when clause> ...
[ <else clause> ]
END
<left paren> <cast operand> <cast target> <right paren>
<position expression> | <extract expression> | <length expression>
<position expression> ::=
<left paren> <character value expression> <character value expression> <right paren>
<concatenation> | <character factor>
<character value expression> <concatenation operator> <character factor>
<character primary> [ <collate clause> ]
<value expression primary> | <string value function>
<character value function> | <bit value function>
<character value function> ::=
<character substring function>
| <fold>
| <form-of-use conversion>
| <character translation>
| <trim function>
<character substring function> ::=
<left paren> <character value expression> <start position> [ <string length> ] <right paren>
<left paren> <character value expression> <right paren>
<form-of-use conversion> ::=
<left paren> <character value expression> <form-of-use conversion name> <right paren>
<character translation> ::=
<left paren> <character value expression> <translation name> <right paren>
<left paren> <trim operands> <right paren>
<trim specification> ] [ <trim character> ] <trim source>
<trim specification> ::= LEADING | TRAILING | BOTH
<bit substring function> ::=
<left paren> <bit value expression> <start position> [ <string length> ] <right paren>
<bit concatenation> | <bit factor>
<bit value expression> <concatenation operator> <bit factor>
<value expression primary> | <string value function>
<left paren> <extract field> <extract source> <right paren>
<datetime field> | <time zone field>
<non-second datetime field> | SECOND
<time zone field> ::= TIMEZONE_HOUR | TIMEZONE_MINUTE
<datetime value expression> | <interval value expression>
<datetime value expression> ::=
<datetime term>
| <interval value expression> <plus sign> <datetime term>
| <datetime value expression> <plus sign> <interval term>
| <datetime value expression> <minus sign> <interval term>
<interval term> ::=
<interval factor>
| <interval term 2> <asterisk> <factor>
| <interval term 2> <solidus> <factor>
| <term> <asterisk> <interval factor>
<value expression primary> [ <interval qualifier> ]
<interval value expression> ::=
<interval term>
| <interval value expression 1> <plus sign> <interval term 1>
| <interval value expression 1> <minus sign> <interval term 1>
| <left paren> <datetime value expression> <minus sign> <datetime term> <right paren> <interval qualifier>
<datetime primary> [ <time zone> ]
<value expression primary> | <datetime value function>
<char length expression> | <octet length expression> | <bit length expression>
<left paren> <string value expression> <right paren>
<character value expression> | <bit value expression>
<left paren> <string value expression> <right paren>
<left paren> <string value expression> <right paren>
<default specification> ::= DEFAULT
<row value constructor element> [ { <comma> <row value constructor element> } ... ]
<comp op> ::=
<equals operator>
| <not equals operator>
| <less than operator>
| <greater than operator>
| <less than or equals operator>
| <greater than or equals operator>
<between predicate> ::=
<row value constructor> [ <row value constructor> <row value constructor>
<row value constructor> [ <in predicate value>
<table subquery> | <left paren> <in value list> <right paren>
<value expression> { <comma> <value expression> } ...
<match value> [ <pattern> [ <escape character> ]
<row value constructor> IS [ NOT ] NULL
<row value constructor> <comp op> <quantifier> <table subquery>
<row value constructor> <table subquery>
<row value constructor 1> <row value constructor 2>
<truth value> ::= TRUE | FALSE | UNKNOWN
<constraint attributes> ::=
<constraint check time> [ [ <constraint check time> ]
<constraint check time> ::= INITIALLY DEFERRED | INITIALLY IMMEDIATE
<constraint name definition> ] <table constraint> [ <constraint check time> ]
<table constraint> ::=
<unique constraint definition>
| <referential constraint definition>
| <check constraint definition>
<unique specification> <left paren> <unique column list> <right paren>
<referential constraint definition> ::=
<left paren> <referencing columns> <right paren> <references specification>
<module contents> ::=
<declare cursor>
| <dynamic declare cursor>
| <procedure>
<declare cursor> ::=
<cursor name> [ <cursor specification>
<query expression> [ <order by clause> ] [ <updatability clause> ]
<sort specification> [ { <comma> <sort specification> }... ]
<sort key> [ <collate clause> ] [ <ordering specification> ]
<column name> | <unsigned integer>
<ordering specification> ::= ASC | DESC
<dynamic declare cursor> ::=
<cursor name> [ <statement name>
<procedure> ::=
<procedure name> <parameter declaration list> <semicolon> <SQL procedure statement> <semicolon>
<parameter declaration list> ::=
<left paren> <parameter declaration> [ { <comma> <parameter declaration> }... ] <right paren>
<parameter name> <data type> | <status parameter>
<status parameter> ::= SQLCODE | SQLSTATE
<SQL procedure statement> ::=
<SQL schema statement>
| <SQL data statement>
| <SQL transaction statement>
| <SQL connection statement>
| <SQL session statement>
| <SQL dynamic statement>
| <SQL diagnostics statement>
<SQL schema statement> ::=
<SQL schema definition statement>
| <SQL schema manipulation statement>
<SQL schema definition statement> ::=
<schema definition>
| <table definition>
| <view definition>
| <grant statement>
| <domain definition>
| <character set definition>
| <collation definition>
| <translation definition>
| <assertion definition>
<schema definition> ::=
<schema name clause>
[ <schema character set specification> ]
[ <schema element> ... ]
<schema name clause> ::=
<schema name>
| <schema authorization identifier>
| <schema name> <schema authorization identifier>
<schema element> ::=
<domain definition>
| <table definition>
| <view definition>
| <grant statement>
| <assertion definition>
| <character set definition>
| <collation definition>
| <translation definition>
<domain definition> ::=
<domain name> [ <data type>
[ <default clause> ] [ <domain constraint> ] [ <collate clause> ]
<domain constraint> ::=
[ <constraint name definition> ] <check constraint definition> [ <constraint attributes> ]
<table definition> ::=
<table name> <table element list> [ ON COMMIT { DELETE | PRESERVE } ROWS ]
<view definition> ::=
<table name> [ <left paren> <view column list> <right paren> ]
<query expression> [ <levels clause> ] CHECK OPTION ]
<levels clause> ::= CASCADED | LOCAL
<grant statement> ::=
<privileges> <object name> <grantee> [ { <comma> <grantee> }... ] [ WITH GRANT OPTION ]
<action> [ { <comma> <action> }... ]
<action> ::=
<left paren> <privilege column list> <right paren> ]
| <left paren> <privilege column list> <right paren> ]
| <left paren> <privilege column list> <right paren> ]
| USAGE
<object name> ::=
[ <table name>
| <domain name>
| <collation name>
| <character set name>
| <translation name>
<assertion definition> ::=
<constraint name> <assertion check> [ <constraint attributes> ]
<left paren> <search condition> <right paren>
<character set definition> ::=
<character set name> [ <character set source>
[ <collate clause> | <limited collation definition> ]
<existing character set name> ::=
<standard character repertoire name>
| <implementation-defined character repertoire name>
| <schema character set name>
<limited collation definition> ::=
<collation source>
<collating sequence definition> | <translation collation>
<collating sequence definition> ::=
<external collation>
| <schema collation name>
| <left paren> <collation name> <right paren>
| DEFAULT
<external collation> ::=
<left paren> <quote> <external collation name> <quote> <right paren>
<standard collation name> | <implementation-defined collation name>
<translation name> [ <collation name> ]
<collation definition> ::=
<collation name> <character set specification>
<collation source> [ <pad attribute> ]
<pad attribute> ::= NO PAD | PAD SPACE
<translation definition> ::=
<translation name>
<source character set specification>
<target character set specification>
<translation source>
<translation specification> ::=
<external translation>
| <schema translation name>
<external translation> ::=
<left paren> <quote> <external translation name> <quote> <right paren>
<external translation name> ::=
<standard translation name>
| <implementation-defined translation name>
<SQL schema manipulation statement> ::=
<drop schema statement>
| <alter table statement>
| <drop table statement>
| <drop view statement>
| <revoke statement>
| <alter domain statement>
| <drop domain statement>
| <drop character set statement>
| <drop collation statement>
| <drop translation statement>
| <drop assertion statement>
<schema name> <drop behaviour>
<drop behaviour> ::= CASCADE | RESTRICT
<table name> <alter table action>
<alter table action> ::=
<add column definition>
| <alter column definition>
| <drop column definition>
| <add table constraint definition>
| <drop table constraint definition>
<column name> <alter column action>
<set column default clause> | <drop column default clause>
<drop column default clause> ::= DROP DEFAULT
<column name> <drop behaviour>
<constraint name> <drop behaviour>
<revoke statement> ::=
<privileges> <object name>
<grantee> [ { <comma> <grantee> }... ] <drop behaviour>
<domain name> <alter domain action>
<alter domain action> ::=
<set domain default clause>
| <drop domain default clause>
| <add domain constraint definition>
| <drop domain constraint definition>
<drop domain default clause> ::= DROP DEFAULT
<domain name> <drop behaviour>
<SQL data statement> ::=
<open statement>
| <fetch statement>
| <close statement>
| <select statement: single row>
| <SQL data change statement>
<fetch statement> ::=
<fetch orientation> ] <cursor name> <fetch target list>
<fetch orientation> ::=
<simple value specification>
<parameter name> | <embedded variable name> | <literal>
<target specification> [ { <comma> <target specification> }... ]
<target specification> ::=
<parameter specification>
| <variable specification>
<select statement: single row> ::=
<set quantifier> ] <select list> <select target list> <table expression>
<target specification> [ { <comma> <target specification> }... ]
<SQL data change statement> ::=
<delete statement: positioned>
| <delete statement: searched>
| <insert statement>
| <update statement: positioned>
| <update statement: searched>
<table name> [ <search condition> ]
<table name> <insert columns and source>
<insert columns and source> ::=
[ <left paren> <insert column list> <right paren> ] <query expression>
| DEFAULT VALUES
<update statement: positioned> ::=
<table name> <set clause list> <cursor name>
<set clause> [ { <comma> <set clause> } ... ]
<object column> <equals operator> <update source>
<value expression> | <null specification> | DEFAULT
<update statement: searched> ::=
<table name> <set clause list> [ <search condition> ]
<SQL transaction statement> ::=
<set transaction statement>
| <set constraints mode statement>
| <commit statement>
| <rollback statement>
<set transaction statement> ::=
<transaction mode> [ { <comma> <transaction mode> }... ]
<transaction mode> ::=
<isolation level>
| <transaction access mode>
| <diagnostics size>
<level of isolation> ::=
READ UNCOMMITTED
| READ COMMITTED
| REPEATABLE READ
| SERIALIZABLE
<transaction access mode> ::= READ ONLY | READ WRITE
<set constraints mode statement> ::=
<constraint name list> { DEFERRED | IMMEDIATE }
<constraint name> [ { <comma> <constraint name> }... ]
<commit statement> ::= COMMIT [ WORK ]
<rollback statement> ::= ROLLBACK [ WORK ]
<SQL connection statement> ::=
<connect statement>
| <set connection statement>
| <disconnect statement>
<connection target> ::=
<SQL-server name> [ <connection name> ] [ <user name> ]
| DEFAULT
<connection object> | ALL | CURRENT
<SQL session statement> ::=
<set catalog statement>
| <set schema statement>
| <set names statement>
| <set session authorization identifier statement>
| <set local time zone statement>
<literal> | <general value specification>
<interval value expression> | LOCAL
<SQL dynamic statement> ::=
<system descriptor statement>
| <prepare statement>
| <deallocate prepared statement>
| <describe statement>
| <execute statement>
| <execute immediate statement>
| <SQL dynamic data statement>
<system descriptor statement> ::=
<allocate descriptor statement>
| <deallocate descriptor statement>
| <get descriptor statement>
| <set descriptor statement>
<descriptor name> [ <occurrences> ]
<scope option> ] <simple value specification>
<scope option> ::= GLOBAL | LOCAL
<set descriptor statement> ::=
<descriptor name> <set descriptor information>
<set descriptor information> ::=
<set count>
| <item number> <set item information> [ { <comma> <set item information> }... ]
<equals operator> <simple value specification 1>
<descriptor item name> <equals operator> <simple value specification 2>
<descriptor item name> ::=
TYPE
| LENGTH
| OCTET_LENGTH
| RETURNED_LENGTH
| RETURNED_OCTET_LENGTH
| PRECISION
| SCALE
| DATETIME_INTERVAL_CODE
| DATETIME_INTERVAL_PRECISION
| NULLABLE
| INDICATOR
| DATA
| NAME
| UNNAMED
| COLLATION_CATALOG
| COLLATION_SCHEMA
| COLLATION_NAME
| CHARACTER_SET_CATALOG
| CHARACTER_SET_SCHEMA
| CHARACTER_SET_NAME
<descriptor name> <get descriptor information>
<get descriptor information> ::=
<get count>
| <item number> <get item information> [ { <comma> <get item information> }... ]
<simple target specification 1> <equals operator> COUNT
<parameter name> | <embedded variable name>
<simple target specification 2> <equals operator> <descriptor item name>
<SQL statement name> <SQL statement variable>
<statement name> | <extended statement name>
<scope option> ] <simple value specification>
<describe input statement> | <describe output statement>
<SQL statement name> <using descriptor>
<SQL statement name> <using descriptor>
<SQL statement name> [ <result using clause> ] [ <parameter using clause> ]
<using arguments> | <using descriptor>
<argument> [ { <comma> <argument> }... ]
<SQL dynamic data statement> ::=
<allocate cursor statement>
| <dynamic open statement>
| <dynamic close statement>
| <dynamic fetch statement>
| <dynamic delete statement: positioned>
| <dynamic update statement: positioned>
<allocate cursor statement> ::=
<extended cursor name> [ <extended statement name>
<scope option> ] <simple value specification>
<dynamic cursor name> [ <using clause> ]
<cursor name> | <extended cursor name>
<dynamic fetch statement> ::=
<fetch orientation> ] <dynamic cursor name>
<dynamic delete statement: positioned> ::=
<table name> <dynamic cursor name>
<dynamic update statement: positioned> ::=
<table name>
<set clause> [ { <comma> <set clause> }... ]
<dynamic cursor name>
<statement information> | <condition information>
<statement information> ::=
<statement information item> [ { <comma> <statement information item> }... ]
<statement information item> ::=
<simple target specification> <equals operator> <statement information item name>
<statement information item name> ::= NUMBER | MORE | COMMAND_FUNCTION | DYNAMIC_FUNCTION | ROW_COUNT
<condition information> ::=
<condition number> <condition information item> [ { <comma> <condition information item> }... ]
<condition information item> ::=
<simple target specification> <equals operator> <condition information item name>
<condition information item name> ::=
CONDITION_NUMBER
| RETURNED_SQLSTATE
| CLASS_ORIGIN
| SUBCLASS_ORIGIN
| SERVER_NAME
| CONNECTION_NAME
| CONSTRATIN_CATALOG
| CONSTRAINT_SCHEMA
| CONSTRAINT_NAME
| CATALOG_NAME
| SCHEMA_NAME
| TABLE_NAME
| COLUMN_NAME
| CURSOR_NAME
| MESSAGE_TEXT
| MESSAGE_LENGTH
| MESSAGE_OCTET_LENGTH
<embedded SQL host program> ::=
<embedded SQL Ada program>
| <embedded SQL C program>
| <embedded SQL Cobol program>
| <embedded SQL Fortran program>
| <embedded SQL MUMPS program>
| <embedded SQL Pascal program>
| <embedded SQL PL/I program>
<embedded SQL Ada program> ::= !! See the syntax rules
<embedded SQL C program> ::= !! See the syntax rules
<embedded SQL Cobol program> ::= !! See the syntax rules
<embedded SQL Fortran program> ::= !! See the syntax rules
<embedded SQL MUMPS program> ::= !! See the syntax rules
<embedded SQL Pascal program> ::= !! See the syntax rules
<embedded SQL PL/I program> ::= !! See the syntax rules
<embedded SQL declare section> ::=
<embedded SQL begin declare>
[ <embedded character set declaration> ]
[ <host variable definition> ... ]
<embedded SQL end declare>
| <embedded SQL MUMPS declare>
<SQL prefix> <SQL terminator> ]
<host variable definition> ::=
<Ada variable definition>
| <C variable definition>
| <Cobol variable definition>
| <Fortran variable definition>
| <MUMPS variable definition>
| <Pascal variable definition>
| <PL/I variable definition>
Note that <colon> is written as a literal colon in the ANSI grammar.
<Ada variable definition> ::=
<Ada host identifier> [ { <comma> <Ada host identifier> }... ] <colon>
<Ada type specification> [ <Ada initial value> ]
<Ada qualified type specification> | <Ada unqualified type specification>
<Ada qualified type specification> ::=
<character set specification> ] <left paren> <double period> <length> <right paren>
| <left paren> <double period> <length> <right paren>
| SQL_STANDARD.SMALLINT
| SQL_STANDARD.INT
| SQL_STANDARD.REAL
| SQL_STANDARD.DOUBLE_PRECISION
| SQL_STANDARD.SQLCODE_TYPE
| SQL_STANDARD.SQLSTATE_TYPE
| SQL_STANDARD.INDICATOR_TYPE
<Ada unqualified type specification> ::=
<left paren> <double period> <length> <right paren>
| <left paren> <double period> <length> <right paren>
| SMALLINT
| INT
| REAL
| DOUBLE_PRECISION
| SQLCODE_TYPE
| SQLSTATE_TYPE
| INDICATOR_TYPE
<Ada assignment operator> <character representation>
<C storage class> ] [ <C class modifier> ] <C variable specification> <semicolon>
<C storage class> ::= auto | extern | static
<C class modifier> ::= const | volatile
<C variable specification> ::=
<C numeric variable>
| <C character variable>
| <C derived variable>
<C numeric variable> ::=
{ <C host identifier> [ <C initial value> ]
[ { <comma> <C host identifier> [ <C initial value> ] }... ]
<equals operator> <character representation>
<C character variable> ::=
<character set specification> ]
<C host identifier> <C array specification> [ <C initial value> ]
[ { <comma> <C host identifier> <C array specification> [ <C initial value> ] }... ]
<left bracket> <length> <right bracket>
<C VARCHAR variable> | <C bit variable>
<C VARCHAR variable> ::=
<character set specification> ]
<C host identifier> <C array specification> [ <C initial value> ]
[ { <comma> <C host identifier> <C array specification> [ <C initial value> ] }... ]
<C bit variable> ::=
<C host identifier> <C array specification> [ <C initial value> ]
[ { <comma> <C host identifier> <C array specification> [ <C initial value> ] }... ]
<Cobol variable definition> ::=
/* ...omitted... */
<Fortran variable definition> ::=
/* ...omitted... */
<MUMPS variable definition> ::=
/* ...omitted... */
<Pascal variable definition> ::=
/* ...omitted... */
<PL/I variable definition> ::=
/* ...omitted... */
<SQL prefix> <SQL terminator> ]
<embedded SQL MUMPS declare> ::=
<SQL prefix>
<embedded character set declaration> ]
[ <host variable definition> ... ]
<SQL terminator>
<SQL prefix> <statement or declaration> [ <SQL terminator> ]
<statement or declaration> ::=
<declare cursor>
| <dynamic declare cursor>
| <temporary table declaration>
| <embedded exception declaration>
| <SQL procedure statement>
<condition> <condition action>
<condition> ::= SQLERROR | NOT FOUND
<goto target> ::=
<host label identifier>
| <unsigned integer>
| <host PL/I label variable>
<host label identifier> ::= !! See the syntax rules
<host PL/I label variable> ::= !! See the syntax rules
<preparable statement> ::=
<preparable SQL data statement>
| <preparable SQL schema statement>
| <preparable SQL transaction statement>
| <preparable SQL session statement>
| <preparable SQL implementation-defined statement>
<preparable SQL data statement> ::=
<delete statement: searched>
| <dynamic single row select statement>
| <insert statement>
| <dynamic select statement>
| <update statement: searched>
| <preparable dynamic delete statement: positioned>
| <preparable dynamic update statement: positioned>
<preparable dynamic delete statement: positioned> ::=
<table name> ] <cursor name>
<preparable dynamic update statement: positioned> ::=
<table name> ] <set clause> <cursor name>
<preparable SQL implementation-defined statement> ::= !! See the syntax rules
<direct SQL statement> ::=
<direct SQL data statement>
| <SQL schema statement>
| <SQL transaction statement>
| <SQL connection statement>
| <SQL session statement>
| <direct implementation-defined statement>
<direct SQL data statement> ::=
<delete statement: searched>
| <direct select statement: multiple rows>
| <insert statement>
| <update statement: searched>
| <temporary table declaration>
<query expression> [ <order by clause> ]
<direct implementation-defined statement> ::= !! See the syntax rules
<SQL provenance> <SQL variant>
<arc3> ::= 9075
<SQL edition> <SQL conformance>
<integrity no> | <integrity yes>
<low> | <intermediate> | <high>