ISO-ANSI Working Draft
Database Language SQL
(SQL3)
February 1993
ISO and ANSI SQL3 Working Draft-February 5, 1993
Digital Equipment Corporation
Maynard, Massachusetts
Contents Page
Foreword.........................................................xiii
Introduction.....................................................xvii
1 Scope ........................................................ 1
2 Normative references ......................................... 3
3 Definitions, notations, and conventions ...................... 7
3.1 Definitions ................................................ 7
3.1.1Definitions taken from ISO/IEC DIS 10646 ................... 7
3.1.2Definitions taken from ISO 8601 ............................ 7
3.1.3Definitions provided in this Standard ...................... 7
3.2 Notation ...................................................12
3.3 Conventions ................................................13
3.3.1Informative elements .......................................14
3.3.2Specification of syntactic elements ........................14
3.3.3Specification of the Information Schema ....................15
3.3.4Use of terms ...............................................15
3.3.4Exceptions .................................................15
3.3.4Syntactic containment ......................................16
3.3.4Terms denoting rule requirements ...........................17
3.3.4Rule evaluation order ......................................17
3.3.4Conditional rules ..........................................18
3.3.4Syntactic substitution .....................................18
3.3.4Other terms ................................................19
3.3.5Descriptors ................................................19
3.3.6Index typography ...........................................20
3.4 Object identifier for Database Language SQL ................21
4 Concepts .....................................................23
4.1 Data types .................................................23
4.2 Character strings ..........................................24
4.2.1Character strings and collating sequences ..................25
4.2.2Operations involving character strings .....................26
4.2.2Operators that operate on character strings and return char-
acter strings...............................................27
4.2.2Other operators involving character strings ................28
4.2.3Rules determining collating sequence usage .................28
4.3 Bit strings ................................................31
4.3.1Bit string comparison and assignment .......................32
4.3.2Operations involving bit strings ...........................32
4.3.2Operators that operate on bit strings and return bit strings
............................................................32
4.3.2Other operators involving bit strings ......................32
ii (ISO-ANSI working draft) Database Language SQL (SQL3)
X3H2-93-091 and YOK-003
4.4 Numbers ....................................................32
4.4.1Characteristics of numbers .................................33
4.4.2Operations involving numbers ...............................34
4.5 Enumerated types ...........................................34
4.6 Boolean types ..............................................35
4.7 Datetimes and intervals ....................................35
4.7.1Datetimes ..................................................36
4.7.2Intervals ..................................................37
4.7.3Operations involving datetimes and intervals ...............39
4.8 Object identifier type .....................................40
4.9 Abstract data types ........................................41
4.9.1Encapsulation ..............................................42
4.9.2Subtypes and supertypes ....................................42
4.9.3Type templates .............................................43
4.10 Collection types ...........................................44
4.10.Set type ...................................................45
4.10.Multiset type ..............................................45
4.10.List type ..................................................46
4.11 Type conversions and mixing of data types ..................46
4.12 Domains ....................................................48
4.13 Nulls ......................................................49
4.14 Columns and attributes .....................................50
4.15 Tables, sets, and lists ....................................51
4.16 Tables .....................................................52
4.17 Integrity constraints ......................................58
4.17.Checking of constraints ....................................58
4.17.Table constraints ..........................................59
4.17.Domain constraints .........................................61
4.17.Assertions .................................................61
4.18 Functional dependencies and candidate keys .................61
4.18.General rules and definitions ..............................62
4.18.Functional dependencies in a base table ....................63
4.18.Functional dependencies in
.......64
4.18.Functional dependencies in a ................64
4.18.Functional dependencies in the result of a ...65
4.18.Functional dependencies in the result of a ..65
4.18.Functional dependencies in the result of a
............................................................66
4.18.Functional dependencies in the result of a
............................................................66
4.18.Functional dependencies in a .........67
4.18.Functional dependencies in a ............67
4.18.Functional dependencies in a .............68
4.18.Selection of primary key or preferred candidate key ........68
4.19 Triggers ...................................................69
Table of Contents iii
X3H2-93-091 and YOK-003
4.19.Triggered actions ..........................................70
4.19.Execution of triggered actions .............................70
4.20 SQL-schemas ................................................70
4.21 Catalogs ...................................................71
4.22 Clusters of catalogs .......................................72
4.23 SQL-data ...................................................72
4.24 SQL-environment ............................................72
4.25 Modules ....................................................73
4.26 Routines ...................................................74
4.27 Parameters .................................................76
4.27.Status parameters ..........................................77
4.27.Data parameters ............................................78
4.27.Indicator parameters .......................................78
4.28 Diagnostics area ...........................................78
4.29 Standard programming languages .............................79
4.30 Cursors ....................................................80
4.31 SQL-statements .............................................82
4.31.Classes of SQL-statements ..................................82
4.31.SQL-statements classified by function ......................83
4.31.Embeddable SQL-statements ..................................87
4.31.Preparable and immediately executable SQL-statements .......89
4.31.Directly executable SQL-statements .........................90
4.31.SQL-statements and transaction states ......................91
4.31.Asynchronous execution .....................................93
4.32 Embedded syntax ............................................94
4.33 SQL dynamic statements .....................................94
4.34 Direct invocation of SQL ...................................97
4.35 Privileges and roles .......................................98
4.36 SQL-agents .................................................101
4.37 SQL-transactions ...........................................101
4.38 SQL-connections ............................................106
4.39 SQL-sessions ...............................................107
4.40 Client-server operation ....................................109
4.41 Information Schema .........................................110
4.42 Leveling ...................................................110
4.43 SQL Flagger ................................................112
5 Lexical elements .............................................115
5.1 ...................................115
5.2 and ....................................118
5.3 ..................................................128
5.4 Names and identifiers ......................................139
iv (ISO-ANSI working draft) Database Language SQL (SQL3)
X3H2-93-091 and YOK-003
6 Scalar expressions ...........................................151
6.1 ................................................151
6.2 and ...........161
6.3 - ...........................................168
6.4
......................................170
6.5 ..........................................172
6.6 and ..................175
6.7 ...............................179
6.8 ...................................183
6.9 ....................................187
6.10 ..................................195
6.11 ............................197
6.12 ..........................................199
6.13 .......................................202
6.14 .........................................221
6.15 .................................225
6.16 ..................................228
6.17 ..............................233
6.18 ................................235
6.19 ................................239
6.20 ...................................243
6.21 .................................245
7 Query expressions ............................................249
7.1 ....................................249
7.2 ..................................253
7.3 ....................................255
7.4 ...............................257
7.5 ...................................259
7.6 .........................................261
7.7 ..............................................263
7.8 .............................................265
7.9 .............................................277
7.10 ..........................................279
7.11 ............................................281
7.12 ......................................283
7.13 .........................................295
7.14 ..........................................310
7.15 , , and ....319
8 Predicates ...................................................321
8.1 ................................................321
8.2 .....................................323
8.3 ........................................329
8.4 .............................................331
8.5 ...........................................333
Table of Contents v
X3H2-93-091 and YOK-003
8.6 ........................................337
8.7 ...........................................349
8.8 ..........................352
8.9 .........................................354
8.10 .........................................355
8.11 ..........................................356
8.12 .......................................359
8.13 .....................................361
8.14 .......................................364
8.15 .......................................366
8.16 ........................................369
8.17 .........................................371
9 Data assignment rules and function determination .............373
9.1 Retrieval assignment .......................................373
9.2 Store assignment ...........................................377
9.3 Set operation result data types and nullabilities ..........381
9.4 Subject routine determination ..............................384
10 Additional common elements ...................................385
10.1 .......................................385
10.2 ..........................................390
10.3 .......................................393
10.4 .................................403
10.5 ...............................................406
10.6 ..............................412
10.7 ...........................................415
10.8 and ...416
11 Schema definition and manipulation ...........................419
11.1 ........................................419
11.2 ....................................423
11.3 .........................................426
11.4 ........................................439
11.5 ...........................................447
11.6 ..............................453
11.7 .............................455
11.8 ........................458
11.9 ..............................469
11.10 ....................................472
11.11 ....................................474
11.12 ..................................476
11.13 ................................478
11.14 ...............................479
11.15 ................................480
11.16 ...................................483
vi (ISO-ANSI working draft) Database Language SQL (SQL3)
X3H2-93-091 and YOK-003
11.17 ....................................486
11.18 ...................................488
11.19 ..........................489
11.20 .........................490
11.21 .....................................492
11.22 ..........................................494
11.23 ......................................500
11.24 ........................................502
11.25 ...................................505
11.26 ................................506
11.27 ...............................507
11.28 .........................508
11.29 ........................509
11.30 ....................................511
11.31 ....................................516
11.32 ................................518
11.33 .................................520
11.34 .............................524
11.35 .....................................526
11.36 .................................533
11.37 ...................................535
11.38 ...............................539
11.39 .....................................541
11.40 .................................545
11.41 .......................................546
11.42 ...................................563
11.43 ...................................565
11.44 ............................568
11.45 ..................................570
11.46 .................................580
11.47 .................................582
11.48 .............................584
11.49 .................................586
11.50 ........................................588
11.51 ....................................590
11.52 ..........................................591
11.53 ..........................................596
11.54 .....................................597
11.55 ....................................599
11.56 ......................................600
11.57 .........................................601
Table of Contents vii
X3H2-93-091 and YOK-003
12 Standard type templates and types ............................613
12.1 Introduction ...............................................613
12.2 SQL type templates and types ...............................613
12.2.Definitions used in this Subclause .........................614
12.2.Concepts used in this Subclause ............................614
12.2.SQL_Table type template ....................................615
12.2.SQL_Set type template ......................................620
12.2.SQL_List type template .....................................622
12.2.SQL_Empty_Table type .......................................625
12.2.SQL_Empty_Set type .........................................627
12.2.SQL_Empty_List type ........................................629
13 Module .......................................................631
13.1 ...................................................631
13.2 ..................................................636
13.3 ..................................654
13.4 Data type correspondences ..................................659
13.5 Rules for externally-invoked s ....................675
14 Control statements ...........................................687
14.1 ...........................................687
14.2 .........................................688
14.3 .......................................690
14.4 ........................................694
14.5 ....................................696
14.6 .................................697
14.7 .....................................699
14.8 ............................................701
14.9 ........................................703
14.10 ...........................................705
14.11 .............................................707
14.12 ..........................................709
14.13 ...........................................710
14.14 .........................................714
14.16 .......................................715
15 Data manipulation ............................................717
15.1 ...........................................717
15.2 ...........................................723
15.3 ..........................................726
15.4 ..........................................730
15.5 .............................732
15.6 .............................734
15.7 ...............................737
15.8 .........................................740
viii (ISO-ANSI working draft) Database Language SQL (SQL3)
X3H2-93-091 and YOK-003
15.9 .............................748
15.10 ...............................754
15.11 ..............................761
15.12 ................................765
16 Transaction management .......................................769
16.1 ................................769
16.2 ...........................771
16.3 ................................773
16.4 ......................................776
16.5 ..............................778
16.6 .........................................779
16.7 .......................................781
17 Connection management ........................................785
17.1 ........................................785
17.2 .................................788
17.3 .....................................790
18 Session management ...........................................793
18.1 ....................................793
18.2 .....................................795
18.3 ......................................797
18.4 ...........799
18.5 .......................................801
18.6 ............................802
19 Dynamic SQL ..................................................805
19.1 Description of SQL item descriptor areas ...................805
19.2 ............................812
19.3 ..........................814
19.4 .................................815
19.5 .................................819
19.6 ........................................823
19.7 ............................830
19.8 .......................................832
19.9 .............................................834
19.10 ........................................843
19.11 ..............................846
19.12 ...................................848
19.13 ................................850
19.14 ...................................852
19.15 ..................................854
19.16 ..................................856
19.17 .....................857
19.18 .....................859
Table of Contents ix
X3H2-93-091 and YOK-003
19.19 ..........861
19.20 ..........863
20 Diagnostics management .......................................865
20.1 ................................865
21 Embedded SQL .................................................879
21.1 ................................879
21.2 ...........................889
21.3 .................................895
21.4 ...................................899
21.5 ...............................904
21.6 .............................908
21.7 ...............................911
21.8 ..............................914
21.9 ................................918
22 Direct invocation of SQL .....................................923
22.1 .....................................923
22.2 ...................928
23 Information Schema and Definition Schema .....................931
23.1 Introduction ...............................................931
23.2 Information Schema .........................................933
23.2.INFORMATION_SCHEMA Schema ..................................933
23.2.INFORMATION_SCHEMA_CATALOG_NAME base table .................934
23.2.INFORMATION_SCHEMA_CATALOG_NAME_CARDINALITY assertion ......935
23.2.SCHEMATA view ..............................................936
23.2.DOMAINS view ...............................................937
23.2.DOMAIN_CONSTRAINTS view ....................................939
23.2.TABLES view ................................................940
23.2.VIEWS view .................................................941
23.2.COLUMNS view ...............................................942
23.2.ABSTRACT_DATA_TYPES view ...................................945
23.2.NULL_CLASSES view ..........................................947
23.2.NULL_STATES view ...........................................948
23.2.TABLE_PRIVILEGES view ......................................949
23.2.COLUMN_PRIVILEGES view .....................................950
23.2.USAGE_PRIVILEGES view ......................................951
23.2.ABSTRACT_DATA_TYPE_PRIVILEGES view .........................952
23.2.ABSTRACT_DATA_TYPE_IMPACT_COLUMN view ......................953
23.2.ABSTRACT_DATA_TYPE_IMPACT_DOMAIN view ......................954
23.2.TABLE_CONSTRAINTS view .....................................955
23.2.REFERENTIAL_CONSTRAINTS view ...............................956
23.2.CHECK_CONSTRAINTS view .....................................957
23.2.KEY_COLUMN_USAGE view ......................................958
x (ISO-ANSI working draft) Database Language SQL (SQL3)
X3H2-93-091 and YOK-003
23.2.ASSERTIONS view ............................................959
23.2.CHARACTER_SETS view ........................................960
23.2.COLLATIONS view ............................................961
23.2.TRANSLATIONS view ..........................................962
23.2.VIEW_TABLE_USAGE view ......................................963
23.2.VIEW_COLUMN_USAGE view .....................................964
23.2.CONSTRAINT_TABLE_USAGE view ................................965
23.2.CONSTRAINT_COLUMN_USAGE view ...............................967
23.2.COLUMN_DOMAIN_USAGE view ...................................969
23.2.ROUTINES view ..............................................970
23.2.TRIGGERS view ..............................................971
23.2.TRIGGERED_ACTIONS view .....................................973
23.2.TRIGGERED_COLUMNS view .....................................974
23.2.SQL_LANGUAGES view .........................................975
23.2.SQL_IDENTIFIER domain ......................................976
23.2.CHARACTER_DATA domain ......................................976
23.2.CARDINAL_NUMBER domain .....................................977
23.3 Definition Schema ..........................................978
23.3.Introduction ...............................................978
23.3.DEFINITION_SCHEMA Schema ...................................979
23.3.USERS base table ...........................................980
23.3.ROLES base table ...........................................981
23.3.SCHEMATA base table ........................................982
23.3.ABSTRACT_DATA_TYPES base table .............................983
23.3.DATA_TYPE_DESCRIPTOR base table ............................984
23.3.DOMAINS base table .........................................991
23.3.DOMAIN_CONSTRAINTS base table ..............................993
23.3.TABLES base table ..........................................995
23.3.VIEWS base table ...........................................997
23.3.COLUMNS base table .........................................999
23.3.VIEW_TABLE_USAGE base table ................................1002
23.3.VIEW_COLUMN_USAGE base table ...............................1003
23.3.TABLE_CONSTRAINTS base table ...............................1004
23.3.KEY_COLUMN_USAGE base table ................................1007
23.3.REFERENTIAL_CONSTRAINTS base table .........................1009
23.3.CHECK_CONSTRAINTS base table ...............................1012
23.3.CHECK_TABLE_USAGE base table ...............................1014
23.3.CHECK_COLUMN_USAGE base table ..............................1015
23.3.ABSTRACT_DATA_TYPE_PRIVILEGES base table ...................1017
23.3.ASSERTIONS base table ......................................1019
23.3.PRIVILEGE_DESCRIPTORS base table ...........................1021
23.3.ROLE_AUTHORIZATION_DESCRIPTORS base table ..................1024
23.3.NULL_CLASSES base table ....................................1025
23.3.NULL_STATES base table .....................................1026
23.3.TABLE_PRIVILEGES base table ................................1027
Table of Contents xi
X3H2-93-091 and YOK-003
23.3.COLUMN_PRIVILEGES base table ...............................1029
23.3.USAGE_PRIVILEGES base table ................................1031
23.3.CHARACTER_SETS base table ..................................1033
23.3.COLLATIONS base table ......................................1035
23.3.TRANSLATIONS base table ....................................1038
23.3.ROUTINES base table ........................................1040
23.3.TRIGGERS base table ........................................1041
23.3.TRIGGERED_ACTIONS base table ...............................1044
23.3.TRIGGERED_COLUMNS base table ...............................1046
23.3.SQL_LANGUAGES base table ...................................1047
23.3.USER_SESSION_ENABLED_ROLES base table ......................1051
23.3.Temporary views ............................................1052
23.3.ENABLED_APPLICABLE_ROLES temporary view ....................1052
23.3.TABLE_PRIVILEGES temporary view ............................1053
23.3.COLUMN_PRIVILEGES temporary view ...........................1054
23.3.ROLE_TABLE_GRANTS temporary view ...........................1055
23.3.ROLE_COLUMN_GRANTS temporary view ..........................1056
23.3.USER_ROLE_GRANTS temporary view ............................1057
23.3.ROLE_ROLE_GRANTS temporary view ............................1058
23.3.ENABLED_ROLES temporary view ...............................1059
23.4 Assertions on the base tables ..............................1060
23.4.UNIQUE_CONSTRAINT_NAME assertion ...........................1060
23.4.EQUAL_KEY_DEGREES assertion ................................1061
23.4.KEY_DEGREE_GREATER_THAN_OR_EQUAL_TO_1 assertion ............1062
23.4.SUB_TABLES base table ......................................1063
24 Status codes .................................................1065
24.1 SQLSTATE ...................................................1065
24.2 SQLCODE ....................................................1074
25 Conformance ..................................................1075
25.1 Introduction ...............................................1075
25.2 Claims of conformance ......................................1075
25.3 Extensions and options .....................................1076
25.4 Flagger requirements .......................................1076
25.5 Processing methods .........................................1077
Annex A Leveling the SQL Language..............................1079
A.1 Full SQL Specifications ....................................1079
A.2 Intermediate SQL Specifications ............................1088
xii (ISO-ANSI working draft) Database Language SQL (SQL3)
X3H2-93-091 and YOK-003
A.3 Entry SQL Specifications ...................................1099
Annex B Implementation-defined elements........................1113
Annex C Implementation-dependent elements......................1127
Annex D Deprecated features....................................1137
Annex E Incompatibilities with X3.135-1992 and ISO/IEC
9075:1992..............................................1139
Annex F Maintenance and interpretation of SQL..................1143
Index
Table of Contents xiii
X3H2-93-091 and YOK-003
TABLES
Table Page
1 Collating coercibility rules for monadic operators .........29
2 Collating coercibility rules for dyadic operators ..........29
3 Collating sequence usage for comparisons ...................30
4 Fields in datetime items ...................................36
5 Fields in year-month INTERVAL items ........................38
6 Fields in day-time INTERVAL items ..........................38
7 Valid values for fields in INTERVAL items ..................38
8 Valid operators involving datetimes and intervals ..........39
9 SQL-transaction isolation levels and the three phenomena ...104
10 Valid values for fields in datetime items ..................158
11 Valid values for fields in INTERVAL items ..................159
12 Truth table for the AND boolean ............................246
13 Truth table for the OR boolean .............................246
14 semantics .................................350
15 Truth table for the IS boolean .............................369
16 Standard programming languages .............................391
17 Data type correspondences for Ada ..........................659
18 Data type correspondences for C ............................661
19 Data type correspondences for COBOL ........................664
20 Data type correspondences for Fortran ......................666
21 Data type correspondences for MUMPS ........................669
22 Data type correspondences for Pascal .......................671
23 Data type correspondences for PL/I .........................673
24 Data types of s used in SQL item descriptor areas
............................................................807
25 Codes used for SQL data types in Dynamic SQL ...............809
26 Codes associated with datetime data types in Dynamic SQL ...810
27 Codes used for s in Dynamic SQL ........810
28 s for use with .....867
29 SQL-statement character codes for use in the diagnostics
area........................................................870
30 SQLSTATE class and subclass values .........................1066
31 SQLCODE values .............................................1074
xiv (ISO-ANSI working draft) Database Language SQL (SQL3)
X3H2-93-091 and YOK-003
Foreword
___________________________________________________________________
ISO Only-SQL3
___________________________________________________________________
ISO (the International Organization for Standardization) and IEC
(the International Electrotechnical Commission) form the spe-
cialized system for worldwide standardization. National bodies
that are members of ISO or IEC participate in the development of
International Standards through technical committees established
by the respective organization to deal with particular fields of
mutual interest. Other international organizations, governmental
and non-governmental, in liaison with ISO and IEC, also take part
in the work.
In the field of information technology, ISO and IEC have es-
tablished a joint technical committee, ISO/IEC JTC 1. Draft
International Standards adopted by the joint technical committee
are circulated to national bodies for voting. Publication as an
International Standard requires approval by at leat 75% of the
national bodies casting a vote.
International Standard ISO/IEC 9075 was prepared by Joint Technical
Committee ISO/IEC JTC 1, Information Technology.
This fourth edition cancels and replaces the third edition (ISO/iEC
9075:1992).
Annexes A, B, C, D, E, and F of this International Standard are for
information only.
___________________________________________________________________
ANSI Only-SQL3
___________________________________________________________________
This Standard (American National Standard X3.135-199x, Database
Language-SQL), is a revision of American National Standard X3.135-
1992, (Database Language), that adds significant new features and
capabilities to the specifications.
ANSI (the American National Standards Institute) is the United
States national standards body charged with development of American
National Standards.
This Standard was approved as an American National Standard by the
American National Standards Institute on (insert date here).
Suggestions for improvement of this Standard are welcome. They
should be sent to the Computer and Business Equipment Manufacturing
Assocation, 311 First Street, NW, Washington, DC 20011.
Foreword xiii
X3H2-93-091 and YOK-003
This Standard was processed and approved for submittal to ANSI
by the Accredited National Standards Committee on Information
Processing Systems, X3. Committee approval of this Standard does
not necessarily imply that all committee members voted for its
approval. At the time that it approved this Standard, the X3
Committee had the following members.
(Insert X3 officer and membership lists here.)
American National Standard X3.135-199x was prepared by Technical
Committee Group X3H2, Database Languages, working under the aus-
pices of Accredited National Standards Committee X3, Information
Processing Systems. Technical Committee X3H2 on Database, which
developed this Standard, had the following members:
Donald R. Deutsch, Chair
Bruce M. Horowitz, Vice-Chair
Michael M. Gorman, Secretary
Leonard J. Gallagher, International Representative
(Insert membership list here.)
Others holding Technical Committee X3H2 membership while the com-
mittee was developing this Standard are the following:
(Insert other membership list here.)
This American Standard was approved in 199x.
This American Standard was developed from ANS X3.135-1992, Database
Language SQL, and replaces that American Standard. It adds signif-
icant new features and capabilities to the specifications. It is
generally compatible with ANS X3.135-1992 in the sense that, with
very few exceptions, SQL language that conforms to ANS X3.135-1992
also conforms to this American Standard, and will be treated in the
same way by an implementation of this American Standard as it would
by an implementation of ANS X3.135-1992 The known incompatibilities
between ANS X3.135-1992 and this American Standard are stated in
Informative Annex E, "Incompatibilities with X3.135-1992 and ISO
/IEC 9075:1992".
Technical changes between ANS X3.135-1992 and this American
Standard include both improvements or enhancements to existing fea-
tures and the definition of new features. Significant improvements
in existing features include:
To Be Supplied.
Significant new features are:
1) Support for active "rules", called triggers.
2) Support for abstract data types.
3) Support for multiple null states.
4) Support for PENDANT referential integrity.
xiv (ISO-ANSI working draft) Database Language SQL (SQL3)
X3H2-93-091 and YOK-003
5) A recursive union operation for query expressions.
6) Support for enumerated and boolean data types.
7) Support for SENSITIVE cursors.
This American Standard contains six Informative annexes:
- Annex A (informative): Leveling the SQL Language;
- Annex B (informative): Implementation-defined elements;
- Annex C (informative): Implementation-dependent elements;
- Annex D (informative): Deprecated features;
- Annex E (informative): Incompatibilities with X3.135-1992 and
ISO/IEC 9075:1992;
- Annex F (informative): Maintenance and interpretation of SQL.
___________________________________________________________________
Foreword xv
X3H2-93-091 and YOK-003
Introduction
The organization of this
American
International
Standard is as follows:
1) Clause 1, "Scope", specifies the scope of this
American
International
Standard.
2) Clause 2, "Normative references", identifies additional stan-
dards that, through reference in this
American
International
Standard, constitute provisions of this
American
International
Standard.
3) Clause 3, "Definitions, notations, and conventions", defines the
notations and conventions used in this
American
International
Standard.
4) Clause 4, "Concepts", presents concepts used in the definition
of SQL.
5) Clause 5, "Lexical elements", defines the lexical elements of
the language.
6) Clause 6, "Scalar expressions", defines the elements of the
language that produce scalar values.
7) Clause 7, "Query expressions", defines the elements of the lan-
guage that produce rows and tables of data.
8) Clause 8, "Predicates", defines the predicates of the language.
9) Clause 9, "Data assignment rules and function determination",
specifies the rules for assignments that retrieve data from
or store data into the database, and formation rules for set
operations.
10)Clause 10, "Additional common elements", defines additional lan-
guage elements that are used in various parts of the language.
Introduction xvii
X3H2-93-091 and YOK-003
11)Clause 11, "Schema definition and manipulation", defines facili-
ties for creating and managing a schema.
12)Clause 13, "Module", defines modules and procedures.
13)Clause 14, "Control statements", defines SQL-statements that
control the execution of procedures.
14)Clause 15, "Data manipulation", defines the data manipulation
statements.
15)Clause 16, "Transaction management", defines the SQL-transaction
management statements.
16)Clause 17, "Connection management" defines the SQL-connection
management statements.
17)Clause 18, "Session management", defines the SQL-session manage-
ment statements.
18)Clause 19, "Dynamic SQL", defines the facilities for executing
SQL-statements dynamically.
19)Clause 20, "Diagnostics management", defines the diagnostics
management facilities.
20)Clause 21, "Embedded SQL", defines syntax for embedding SQL in
certain standard programming languages.
21)Clause 22, "Direct invocation of SQL", defines the direct invo-
cation of SQL language.
22)Clause 23, "Information Schema and Definition Schema", defines
viewed tables that contain schema information.
23)Clause 24, "Status codes", defines values that identify the
status of the execution of SQL-statements and the mechanisms by
which those values are returned.
24)Clause 25, "Conformance", defines the criteria for conformance
to this
American
International
standard.
25)Annex A, "Leveling the SQL Language", is an informative
Annex. It lists the leveling rules defining the Entry SQL and
Intermediate SQL subset levels SQL levels of the SQL language.
26)Annex B, "Implementation-defined elements", is an informative
Annex. It lists those features for which the body of the
American
International
Standard states that the syntax or meaning or effect on the
xviii (ISO-ANSI working draft) Database Language SQL (SQL3)
X3H2-93-091 and YOK-003
database is partly or wholly implementation-defined, and de-
scribes the defining information that an implementor shall
provide in each case.
27)Annex C, "Implementation-dependent elements", is an informative
Annex. It lists those features for which the body of the
American
International
Standard states explicitly that the meaning or effect on the
database is implementation-dependent.
28)Annex D, "Deprecated features", is an informative Annex. It
lists features that the responsible Technical Committee intend
will not appear in a future revised version of this
American
International
Standard.
29)Annex E, "Incompatibilities with X3.135-1992 and ISO/IEC
9075:1992", is an informative Annex. It lists incompatibili-
ties with the previous version of this
American
International
Standard.
30)Annex F, "Maintenance and interpretation of SQL", is an infor-
mative Annex. It identifies SQL interpretations and corrections
that have been processed by
ANSI Accredited Committee X3
ISO/IEC JTC1/SC21
since adoption of
ANSI X3.135-1989.
ISO/IEC 9075:1989.
In the text of this
American
International
Standard, Clauses begin a new odd-numbered page, and in Clause 5,
"Lexical elements", through Clause 24, "Status codes", Subclauses
begin a new page. Any resulting blank space is not significant.
Introduction xix
X3H2-93-091 and YOK-003
Information Technology - Database Languages - SQL
1 Scope
This
American
International
Standard defines the data structures and basic operations on SQL-
data. It provides functional capabilities for creating, accessing,
maintaining, controlling, and protecting SQL-data.
Note: The framework for this
American
International
Standard is described by the Reference Model of Data Management
(ISO DIS 10032:1991).
This
American
International
Standard specifies the syntax and semantics of a database language:
- for specifying and modifying the structure and the integrity
constraints of SQL-data;
- for declaring and invoking operations on SQL-data and cursors;
and
- for declaring database language procedures and embedding them
into a standard programming language.
It also specifies an Information Schema that describes the struc-
ture and the integrity constraints of SQL-data.
This
American
International
Standard provides a vehicle for portability of data definitions and
compilation units between SQL-implementations.
This