Documentation Source Text

Check-in [451999a899]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Continuing work on SQL language requirements.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 451999a899806ad0ae74c0e93b014a34ba8269be
User & Date: drh 2008-08-10 19:23:30
Context
2008-08-11
17:13
Ignore API tags for experimental and deprecated. check-in: 2ad6f9191f user: shaneh tags: trunk
2008-08-10
19:23
Continuing work on SQL language requirements. check-in: 451999a899 user: drh tags: trunk
2008-08-09
00:01
Continuing work on syntax requirements. check-in: ce20876314 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to pages/syntax.in.

1
2
3
4
5
6
7
8
..
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
...
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
...
377
378
379
380
381
382
383




384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404

405
406
407
408
409

410
411
412
413
414
415
416
417
...
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464

465
466
467
468
469
470
471
...
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
...
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
...
642
643
644
645
646
647
648









649
650
651
652
653
654
655
...
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
...
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719

720
721
722
723
724
725
726
...
728
729
730
731
732
733
734



735
736
737
738
739
740
741
742
743
744
745
746
747















748
749
750
751
752
753
754
755
756
757
758

























































759
760
761
762
763
764
765
766
767
768
769




















770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792

793
794
795
796
797
798
799
800
801










































802

803
804
805
806
807
808
809
810
811
812




















813
814
815
816
817
818
819
...
856
857
858
859
860
861
862
863
864
865









866
867
868
869
870
871
872
...
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892


893
894
895
896
897
898
899
900
901
902
903









904
905
906
907
908
909
910
...
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935

936
937
938
939
940
941
942
943
944
...
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
...
999
1000
1001
1002
1003
1004
1005
1006
1007
1008

1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020




1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
....
1073
1074
1075
1076
1077
1078
1079

1080

1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094

1095
1096
1097
1098
1099
1100
1101
....
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
....
1129
1130
1131
1132
1133
1134
1135


1136
1137
1138
1139
1140
1141
1142
<title>SQLite SQL Syntax Requirements</title>

<tcl>
proc syntaxreq {id derivedfrom explaination text {bnf {}}} {
  hd_fragment $id $id
  set dlist {}
  foreach d $derivedfrom {
    append dlist <$d>
................................................................................
  global syntax_dcnt
  incr syntax_dcnt
  eval hd_fragment D$syntax_dcnt $namelist
  hd_resolve "\n<p>$text</p>\n\n"
}
</tcl>

<h1>SQLite Syntax Requirements</h1>

<p>These requirements make the distinction between "preparing" an
SQL statement and "evaluating" or "invoking" an SQL statement.
Preparation means that the SQL statement text is translated into
an internal binary representation that is more suitable for processing.
Evaluation or invocation means that the processing is actually carried out.
Preparation of an SQL statement is usually accomplished by interfaces
................................................................................
syntaxreq {H42325} {} {} {
  The preparation of a CREATE TABLE statement shall fail with an 
  error if the IF NOT EXISTS clause is omitted and the <i>objectname</i>
  is the same as the name of a table or view
  in the same database.
}
syntaxreq {H42328} {} {} {
  A CREATE TABLE statement shall be a silent no-op if the
  IF NOT EXISTS clause is present and the <i>objectname</i>
  is the same as the name of a table or view
  in the same database.
}
syntaxreq {H42331} {} {} {
  A CREATE TABLE statement shall fail with an error if the
  the <i>objectname</i> is the same as the name of an index
  in any database attached to the same [database connection].
}
syntaxreq {H42334} {} {} {
  A CREATE TABLE statement shall fail with an error if the
  the <i>databasename</i> references a database that is not
  attached to the same [database connection].
}
</tcl>

<h4>2.1.1 CREATE TABLE column definitions</h4>

................................................................................
  conflict ::= ON CONFLICT IGNORE.
  conflict ::= ON CONFLICT REPLACE.
  conflict ::= ON CONFLICT ABORT.
  conflict ::= ON CONFLICT FAIL.
  conflict ::= ON CONFLICT ROLLBACK.
}
syntaxreq {H42453} {} {} {




  If a column has no DEFAULT constraint then the default value for
  that column shall be NULL.
}
syntaxreq {H42456} {} {} {
  Every column a table shall have a "NULL conflict resolution behavior"
  which is one of NONE, IGNORE, REPLACE, FAIL, ABORT, or ROLLBACK.
}
syntaxreq {H42459} {} {
  The default NULL conflict resolution behavior is NONE, which means
  NULLs are allowed in the column.  This can be made explicit by
  specifying the NULL constraint.  But the use of the NULL constraint
  is merely comment for human readers.  SQLite silently ignores the
  NULL constraint and its ON CONFLICT clause.  SQLite only cares
  about NOT NULL constraints since only NOT NULL constraints make
  a behaviorial difference.
} {
  If a column has no NOT NULL constraint then the NULL conflict
  resolution behavior for the column shall be NONE.
}
syntaxreq {H42462} {} {} {
  If a column has a NOT NULL constraint without an ON CONFLICT clause

  then the NULL conflict resolution behavior for the column shall
  be ABORT.
}
syntaxreq {H42465} {} {} {
  If a column has a NOT NULL constraint with an ON CONFLICT clause

  then the NULL conflict resolution behavior for the column shall
  be the behavior specified by the ON CONFLICT clause.
}
syntaxreq {H42467} {} {} {
  A column without a COLLATE constraint shall have a default
  collating sequence of BINARY.
}
syntaxreq {H42468} {} {} {
................................................................................
  an alias for the table rowid.
}
syntaxreq {H42476} {} {} {
  If a table contains no column named "_ROWID_" then "_ROWID_" shall be
  an alias for the table rowid.
}
syntaxreq {H42478} {} {
  The AUTOINCREMENT keyword is ignored except for on an explicit
  rowid column.
} {
  A table shall have an autoincrementing rowid if and only if
  the PRIMARY KEY for the table is an alias for the rowid and
  the PRIMARY KEY declaration uses the AUTOINCR keyword.
}

syntaxreq {H42480} {} {} {
  Successful evaluation of a CREATE TABLE statement that contains
  a column UNIQUE constraint without an ON CONFLICT shall create
  unique index on the column and with a conflict resolution 
  algorithm of ABORT.
}
syntaxreq {H42483} {} {} {
  Successful evaluation of a CREATE TABLE statement that contains
  a column UNIQUE constraint with an ON CONFLICT shall create
  unique index on the column and with the specified conflict 
  resolution algorithm.

}


syntaxreq {H42510} {} {} {
  The SQLite parser shall accept the following syntax for the list of table
  contraints that occurs at the end of an [ordinary CREATE TABLE statement].
} {
................................................................................
}
syntaxreq {H42517} {} {} {
  The preparation of a CREATE TABLE statement that contains a
  CHECK constraint that uses a parameter shall fail with an error.
}
syntaxreq {H42518} {} {} {
  The preparation of a CREATE TABLE statement that contains a
  CHECK constraint that references any column of any table other than
  the table being created shall fail with an error.
}
syntaxreq {H42521} {} {} {
  The preparation of a CREATE TABLE statement that contains a
  DEFAULT constraint with an non-constant expression
  shall fail with an error.
}
syntaxreq {H42530} {} {
  Multi-column UNIQUE constraints work just like column UNIQUE
  constraints in that they generate a unique index on the column
  or columns specified.
} {
  Successful evaluation of a CREATE TABLE statement that contains
  a multi-column UNIQUE constraint without an ON CONFLICT shall create
  unique index on the specified columns and with a conflict 
  resolution algorithm of ABORT.
}
syntaxreq {H42532} {} {} {
  Successful evaluation of a CREATE TABLE statement that contains
  a multi-column UNIQUE constraint with an ON CONFLICT shall create
  unique index on the specified columns and with the specified 
  conflict resolution algorithm.
}
syntaxreq {H42536} {} {
  Except for the special case of INTEGER PRIMARY KEY, a
  PRIMARY KEY is just an alias for UNIQUE.
} {
  A PRIMARY KEY constraint that does not result in a rowid alias
  shall have the same effect as a UNIQUE constraint.
}
................................................................................
  statement shall have base names which are the names of the columns
  in the result set of the SELECT statement
}
syntaxreq {H42617} {} {} {
  Each column name in a table generated by a CREATE TABLE AS
  statement shall have an arbitrary suffix appended to its basename
  if and only if such a suffix is necessary to make the name
  different from all preceding column names in the table.
}
syntaxreq {H42619} {} {} {
  All columns in a table generated by a CREATE TABLE AS statement
  shall have a default value of NULL.
}
syntaxreq {H42622} {} {} {
  All columns in a table generated by a CREATE TABLE AS statement
................................................................................
  database and discarded.
}
syntaxreq {H42719} {} {} {
  The successful evaluation of a DROP TABLE statement shall cause
  all indices attached to the table identified by <i>fullname</i>
  to be removed from their database and discarded.
}









</tcl>

<h3>2.3 CREATE INDEX</h3>

<tcl>
syntaxreq {H42800} {} {} {
  The SQLite parser shall accept CREATE INDEX statements that 
................................................................................
  sortorder ::= .
  sortorder ::= ASC.
  sortorder ::= DESC.
}
syntaxreq {H42803} {} {} {
  The target database of a CREATE INDEX statement shall be the 
  <i>databasename</i> specified in the <i>fullname</i> term of the
  statement if that <i>databasename</i> exists.
}
syntaxreq {H42806} {} {} {
  If the <i>fullname</i> term of a CREATE INDEX statement does not
  specify a <i>databasename</i> and the <i>tablename</i> references a table 
  that is in the "temp" database, then the target database for the statement
  shall be "temp".
}
................................................................................
  A successful evaluation of a CREATE INDEX statement shall create a 
  new index called <i>objectname</i>
  in the database of the statement and attached to the
  table identified by <i>tablename</i> in that same database.
}
syntaxreq {H42821} {} {} {
  An index generated by a CREATE INDEX statement that omits the
  UNIQUE keyword shall have a uniqueness conflict resolution behavior
  of NONE.
}
syntaxreq {H42824} {} {} {
  An index generated by a CREATE INDEX statement that includes the
  UNIQUE keyword shall have a uniqueness conflict resolution behavior
  of ABORT.
}
syntaxreq {H42830} {} {} {
  The preparation of a CREATE INDEX statement shall fail with an error if any
  <i>columnname</i> value within the <i>indexlist</i> is not the
  name of one of the columns of the <i>tablename</i> table.
}
syntaxreq {H42833} {} {
  The following rules regarding default collating sequences and
  sort order for indices applies both to indices created by CREATE INDEX

  and also by UNIQUE or PRIMARY KEY constraints on the table definition.
} {
  The collating sequence for each column of an index shall be the
  collating sequence specified in the <i>indexlist</i>.
}
syntaxreq {H42836} {} {} {
  If an index column does not specify a collating sequence then
................................................................................
  the default collating sequence of the corresponding table column.
}
syntaxreq {H42839} {} {} {
  The sort order for an index column shall be descending if and only
  if the DESC keyword is used in the <i>indexlist</i> entry for that
  term.
}





</tcl>

<h3>2.4 DROP INDEX</h3>

<tcl>
syntaxreq {H42900} {} {} {
  The SQLite parser shall accept DROP INDEX statements 
  that conform to the following syntax:
} {
  cmd ::= DROP INDEX ifexists fullname.
}















</tcl>

<h3>2.5 CREATE VIEW</h3>

<tcl>
syntaxreq {H43100} {} {} {
  The SQLite parser shall accept CREATE VIEW statements 
  that conform to the following syntax:
} {
  cmd ::= CREATE temp VIEW ifnotexists fullname AS select.
}

























































</tcl>

<h3>2.6 DROP VIEW</h3>

<tcl>
syntaxreq {H43200} {} {} {
  The SQLite parser shall accept DROP VIEW statements
  that conform to the following syntax:
} {
  cmd ::= DROP VIEW ifexists fullname.
}




















</tcl>

<h3>2.7 CREATE TRIGGER</h3>

<tcl>
syntaxreq {H43300} {} {} {
  The SQLite parser shall accept CREATE TRIGGER statements
  that conform to the following syntax:
} {
  cmd ::= CREATE temp TRIGGER ifnotexists fullname trigger trigger_body.
  trigger ::= trigger_time trigger_event ON fullname foreach_clause when_clause.
  trigger_body ::= BEGIN trigger_cmd_list END.
  trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI.
  trigger_cmd_list ::=.
  trigger_cmd ::= DELETE FROM name where_opt.
  trigger_cmd ::= UPDATE orconf name SET setlist where_opt.
  trigger_cmd ::= insert_cmd INTO name inscollist_opt VALUES LP itemlist RP.
  trigger_cmd ::= insert_cmd INTO name inscollist_opt select.
  trigger_cmd ::= select.
  trigger_event ::= DELETE.
  trigger_event ::= INSERT.
  trigger_event ::= UPDATE OF inscollist.
  trigger_event ::= UPDATE.

  trigger_time ::= AFTER.
  trigger_time ::= BEFORE.
  trigger_time ::= INSTEAD OF.
  trigger_time ::=.
  foreach_clause ::= FOR EACH ROW.
  foreach_clause ::=.
  when_clause ::= WHEN expr.
  when_clause ::=.
}










































</tcl>


<h3>2.8 DROP TRIGGER</h3>

<tcl>
syntaxreq {H43500} {} {} {
  The SQLite parser shall accept DROP TRIGGER statements
  that conform to the following syntax:
} {
  cmd ::= DROP TRIGGER ifexists fullname.
}




















</tcl>

<h3>2.9 CREATE VIRTUAL TABLE</h3>

<tcl>
syntaxreq {H43600} {} {} {
  The SQLite parser shall accept CREATE VIRTUAL TABLE statements
................................................................................

<h4>3.1.1 INSERT VALUE</h4>
<tcl>
syntaxreq {H43810} {} {} {
  The SQLite parser shall accept INSERT VALUE statements that
  conform to the following syntax:
} {
  cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP.
  insert_cmd ::= INSERT orconf.
  insert_cmd ::= REPLACE.









}
</tcl>
<h4>3.1.3 INSERT DEFAULT</h4>
<tcl>
syntaxreq {H43820} {} {} {
  The SQLite parser shall accept INSERT DEFAULT statements that
  conform to the following syntax:
................................................................................
}
</tcl>
<h4>3.1.3 INSERT SELECT</h4>
syntaxreq {H43830} {} {} {
  The SQLite parser shall accept INSERT SELECT statements that
  conform to the following syntax:
} {
  cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES.
}
</tcl>
<h3>3.2 DELETE</h3>

<tcl>
syntaxreq {H43900} {} {} {
  The SQLite parser shall accept DELETE statements that
  conform to the following syntax:
} {
  cmd ::= DELETE FROM fullname where_opt.


}
</tcl>

<h3>3.3 UPDATE</h3>

<tcl>
syntaxreq {H44100} {} {} {
  The SQLite parser shall accept UPDATE statements that
  conform to the following syntax:
} {
  cmd ::= UPDATE orconf fullname SET setlist where_opt.









}
</tcl>

<h3>3.4 SELECT</h3>

<tcl>
syntaxreq {H45000} {} {} {
................................................................................
  cmd ::= select.
  select ::= query.
  select ::= select UNION query.
  select ::= select UNION ALL query.
  select ::= select EXCEPT query.
  select ::= select INTERSECT query.
  query ::= SELECT distinct resultset from where groupby having orderby limit.
  where ::= .
  where ::= WHERE expr.
  groupby ::= .
  groupby ::= GROUP BY exprlist.
  having ::= .
  having ::= HAVING expr.
  orderby ::= .
  orderby ::= ORDER BY exprlist.
  limit ::=.
  limit ::= LIMIT expr.
  limit ::= LIMIT expr COMMA expr.
  limit ::= LIMIT expr OFFSET expr.
  resultset ::= result.
  resultset ::= resultset COMMA result.
  result ::= STAR.

  result ::= expr as.
  result ::= name DOT STAR.
  from ::= .
  from ::= FROM sourceset.
  sourceset ::= source.
  sourceset ::= sourceset joinop source.
  source ::= fullname as on using.
  source ::= LP select RP as on using.
  as ::= .
................................................................................
  on ::= .
  on ::= ON expr.
  using ::= .
  using ::= USING LP idlist RP.
  joinop ::= COMMA.
  joinop ::= JOIN.
  joinop ::= JOIN_KW JOIN.
  joinop ::= JOIN_KW name JOIN.
  joinop ::= JOIN_KW name name JOIN.
}
</tcl>

<h2>4.0 Other Language Elements</h2>

<h3>4.1 VACUUM</h3>

................................................................................
<tcl>
syntaxreq {H46000} {} {} {
  The SQLite parser shall accept PRAGMA statements
  that conform to the following syntax:
} {
  cmd ::= PRAGMA fullname EQ DELETE.
  cmd ::= PRAGMA fullname EQ ON.
  cmd ::= PRAGMA fullname EQ minus_num.
  cmd ::= PRAGMA fullname EQ nmnum.
  cmd ::= PRAGMA fullname LP nmnum RP.

  cmd ::= PRAGMA fullname.
}
</tcl>

<h3>4.5 ATTACH</h3>

<tcl>
syntaxreq {H44500} {} {} {
  The SQLite parser shall accept ATTACH statements
  that conform to the following syntax:
} {
  cmd ::= ATTACH database_kw_opt expr AS expr key_opt.




}
</tcl>

<h3>4.6 DETACH</h3>

<tcl>
syntaxreq {H44600} {} {} {
  The SQLite parser shall accept DETACH statements
  that conform to the following syntax:
} {
  cmd ::= DETACH database_kw_opt expr.
}
</tcl>

<h3>4.7 EXPLAIN</h3>

<tcl>
syntaxreq {H44700} {} {} {
................................................................................
  expr ::= JOIN_KW.
  expr ::= LP expr RP.
  expr ::= LP select RP.
  expr ::= MINUS expr.
  expr ::= NOT expr.
  expr ::= PLUS expr.
  expr ::= RAISE LP IGNORE RP.

  expr ::= RAISE LP raisetype COMMA name RP.

  expr ::= REGISTER.
  expr ::= VARIABLE.
  expr ::= expr AND expr.
  expr ::= expr BITAND expr.
  expr ::= expr BITOR expr.
  expr ::= expr LSHIFT expr.
  expr ::= expr RSHIFT expr.
  expr ::= expr COLLATE ids.
  expr ::= expr CONCAT expr.
  expr ::= expr EQ expr.
  expr ::= expr NE expr.
  expr ::= expr IS NOT NULL.
  expr ::= expr IS NULL.
  expr ::= expr ISNULL|NOTNULL.

  expr ::= expr LT expr.
  expr ::= expr GT expr.
  expr ::= expr GE expr.
  expr ::= expr LE expr.
  expr ::= expr NOT NULL.
  expr ::= expr OR expr.
  expr ::= expr PLUS expr.
................................................................................
  expr ::= expr NOT IN LP exprlist RP.
  expr ::= expr NOT IN LP select RP.
  expr ::= expr NOT IN fullname.
  expr ::= expr LIKE_KW expr escape.
  expr ::= expr MATCH expr escape.
  expr ::= expr NOT LIKE_KW expr escape.
  expr ::= expr NOT MATCH expr escape.
  expr ::= name DOT name DOT name.
  expr ::= name DOT name.
  expr ::= term.
  term ::= CTIME_KW.
  term ::= INTEGER.
  term ::= FLOAT
  term ::= BLOB.
  term ::= NULL.
  term ::= STRING.
................................................................................
  case_else ::= ELSE expr.
  case_else ::= .
  case_exprlist ::= WHEN expr THEN expr.
  case_exprlist ::= case_exprlist WHEN expr THEN expr.
  case_operand ::= expr.
  case_operand ::= .
  function_name ::= ID.


}
</tcl>

<h3>5.2 Functions</h3>
<h4>5.2.1 Core Scalar Functions</h4>
<h4>5.2.2 Date and Time Functions</h4>
<h4>5.2.3 Aggregate Functions</h4>
|







 







|







 







|





|




|







 







>
>
>
>



|
|
|
|
<
|


|








|
>
|



|
>
|







 







|








|
|
|
<
<
<
<
<
<
|
>







 







|







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







|







 







>
>
>
>
>
>
>
>
>







 







|







 







|




|










>







 







>
>
>
|












>
>
>
>
>
>
>
>
>
>
>
>
>
>
>











>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>











>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>










|



|
|
|
|

|
|
|
|
>









>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>










>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
|

>
>
>
>
>
>
>
>
>







 







|









|
>
>










|
>
>
>
>
>
>
>
>
>







 







|
|













>

<







 







|
|







 







|
|
|
>











|
>
>
>
>










|







 







>
|
>













|
>







 







|
|







 







>
>







1
2
3
4
5
6
7
8
..
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
...
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
...
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394

395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
...
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462






463
464
465
466
467
468
469
470
471
...
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
















503
504
505
506
507
508
509
...
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
...
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
...
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
...
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
...
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
....
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
....
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
....
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110

1111
1112
1113
1114
1115
1116
1117
....
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
....
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
....
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
....
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
....
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
<title>SQLite SQL Language Requirements</title>

<tcl>
proc syntaxreq {id derivedfrom explaination text {bnf {}}} {
  hd_fragment $id $id
  set dlist {}
  foreach d $derivedfrom {
    append dlist <$d>
................................................................................
  global syntax_dcnt
  incr syntax_dcnt
  eval hd_fragment D$syntax_dcnt $namelist
  hd_resolve "\n<p>$text</p>\n\n"
}
</tcl>

<h1>SQLite Language Requirements</h1>

<p>These requirements make the distinction between "preparing" an
SQL statement and "evaluating" or "invoking" an SQL statement.
Preparation means that the SQL statement text is translated into
an internal binary representation that is more suitable for processing.
Evaluation or invocation means that the processing is actually carried out.
Preparation of an SQL statement is usually accomplished by interfaces
................................................................................
syntaxreq {H42325} {} {} {
  The preparation of a CREATE TABLE statement shall fail with an 
  error if the IF NOT EXISTS clause is omitted and the <i>objectname</i>
  is the same as the name of a table or view
  in the same database.
}
syntaxreq {H42328} {} {} {
  The evaluation of a CREATE TABLE statement shall be a silent no-op if the
  IF NOT EXISTS clause is present and the <i>objectname</i>
  is the same as the name of a table or view
  in the same database.
}
syntaxreq {H42331} {} {} {
  The preparation of a CREATE TABLE statement shall fail with an error if the
  the <i>objectname</i> is the same as the name of an index
  in any database attached to the same [database connection].
}
syntaxreq {H42334} {} {} {
  The preparation of a CREATE TABLE statement shall fail with an error if the
  the <i>databasename</i> references a database that is not
  attached to the same [database connection].
}
</tcl>

<h4>2.1.1 CREATE TABLE column definitions</h4>

................................................................................
  conflict ::= ON CONFLICT IGNORE.
  conflict ::= ON CONFLICT REPLACE.
  conflict ::= ON CONFLICT ABORT.
  conflict ::= ON CONFLICT FAIL.
  conflict ::= ON CONFLICT ROLLBACK.
}
syntaxreq {H42453} {} {} {
  When a column as a DEFAULT constraint, the default value for the
  column shall be the value specified by that constraint.
}
syntaxreq {H42456} {} {} {
  If a column has no DEFAULT constraint then the default value for
  that column shall be NULL.
}
syntaxreq {H42459} {} {
  Every column a table has a "null-conflict resolution behavior"
  which is one of NONE, IGNORE, REPLACE, FAIL, ABORT, or ROLLBACK.</p>


  <p>The default null-conflict resolution behavior is NONE, which means
  NULLs are allowed in the column.  This can be made explicit by
  specifying the NULL constraint.  But the use of the NULL constraint
  is merely a comment for human readers.  SQLite silently ignores the
  NULL constraint and its ON CONFLICT clause.  SQLite only cares
  about NOT NULL constraints since only NOT NULL constraints make
  a behaviorial difference.
} {
  If a column has no NOT NULL constraint then the NULL conflict
  resolution behavior for the column shall be NONE.
}
syntaxreq {H42462} {} {} {
  If a column has a NOT NULL constraint and that constrait lacks
  an ON CONFLICT clause
  then the null-conflict resolution behavior for the column shall
  be ABORT.
}
syntaxreq {H42465} {} {} {
  If a column has a NOT NULL constraint and that constraint
  has an ON CONFLICT clause
  then the null-conflict resolution behavior for the column shall
  be the behavior specified by the ON CONFLICT clause.
}
syntaxreq {H42467} {} {} {
  A column without a COLLATE constraint shall have a default
  collating sequence of BINARY.
}
syntaxreq {H42468} {} {} {
................................................................................
  an alias for the table rowid.
}
syntaxreq {H42476} {} {} {
  If a table contains no column named "_ROWID_" then "_ROWID_" shall be
  an alias for the table rowid.
}
syntaxreq {H42478} {} {
  The AUTOINCREMENT keyword is ignored except when it appears on an explicit
  rowid column.
} {
  A table shall have an autoincrementing rowid if and only if
  the PRIMARY KEY for the table is an alias for the rowid and
  the PRIMARY KEY declaration uses the AUTOINCR keyword.
}

syntaxreq {H42480} {} {} {
  Successful evaluation of a CREATE TABLE statement shall create
  an index for every UNIQUE constraint where the created index has
  a conflict resolution algorithm as specified by the ON CONFLICT






  clause of the UNIQUE constraint or a conflict resolution algorithm
  of ABORT if there is no ON CONFLICT clause on the constraint.
}


syntaxreq {H42510} {} {} {
  The SQLite parser shall accept the following syntax for the list of table
  contraints that occurs at the end of an [ordinary CREATE TABLE statement].
} {
................................................................................
}
syntaxreq {H42517} {} {} {
  The preparation of a CREATE TABLE statement that contains a
  CHECK constraint that uses a parameter shall fail with an error.
}
syntaxreq {H42518} {} {} {
  The preparation of a CREATE TABLE statement that contains a
  CHECK constraint that references any column of a table other than
  the table being created shall fail with an error.
}
syntaxreq {H42521} {} {} {
  The preparation of a CREATE TABLE statement that contains a
  DEFAULT constraint with an non-constant expression
  shall fail with an error.
}
















syntaxreq {H42536} {} {
  Except for the special case of INTEGER PRIMARY KEY, a
  PRIMARY KEY is just an alias for UNIQUE.
} {
  A PRIMARY KEY constraint that does not result in a rowid alias
  shall have the same effect as a UNIQUE constraint.
}
................................................................................
  statement shall have base names which are the names of the columns
  in the result set of the SELECT statement
}
syntaxreq {H42617} {} {} {
  Each column name in a table generated by a CREATE TABLE AS
  statement shall have an arbitrary suffix appended to its basename
  if and only if such a suffix is necessary to make the name
  distinct from all preceding column names in the table.
}
syntaxreq {H42619} {} {} {
  All columns in a table generated by a CREATE TABLE AS statement
  shall have a default value of NULL.
}
syntaxreq {H42622} {} {} {
  All columns in a table generated by a CREATE TABLE AS statement
................................................................................
  database and discarded.
}
syntaxreq {H42719} {} {} {
  The successful evaluation of a DROP TABLE statement shall cause
  all indices attached to the table identified by <i>fullname</i>
  to be removed from their database and discarded.
}
syntaxreq {H42721} {} {} {
  The successful evaluation of a DROP TABLE statement shall cause
  all triggers attached to the table identified by <i>fullname</i>
  to be removed from their database and discarded.
}
syntaxreq {H42724} {} {} {
  The preparation of a DROP TABLE statement shall fail with an
  error if <i>fullname</i> is a system table.
}
</tcl>

<h3>2.3 CREATE INDEX</h3>

<tcl>
syntaxreq {H42800} {} {} {
  The SQLite parser shall accept CREATE INDEX statements that 
................................................................................
  sortorder ::= .
  sortorder ::= ASC.
  sortorder ::= DESC.
}
syntaxreq {H42803} {} {} {
  The target database of a CREATE INDEX statement shall be the 
  <i>databasename</i> specified in the <i>fullname</i> term of the
  statement if the <i>databasename</i> exists.
}
syntaxreq {H42806} {} {} {
  If the <i>fullname</i> term of a CREATE INDEX statement does not
  specify a <i>databasename</i> and the <i>tablename</i> references a table 
  that is in the "temp" database, then the target database for the statement
  shall be "temp".
}
................................................................................
  A successful evaluation of a CREATE INDEX statement shall create a 
  new index called <i>objectname</i>
  in the database of the statement and attached to the
  table identified by <i>tablename</i> in that same database.
}
syntaxreq {H42821} {} {} {
  An index generated by a CREATE INDEX statement that omits the
  UNIQUE keyword shall have a conflict resolution behavior
  of NONE.
}
syntaxreq {H42824} {} {} {
  An index generated by a CREATE INDEX statement that includes the
  UNIQUE keyword shall have a conflict resolution behavior
  of ABORT.
}
syntaxreq {H42830} {} {} {
  The preparation of a CREATE INDEX statement shall fail with an error if any
  <i>columnname</i> value within the <i>indexlist</i> is not the
  name of one of the columns of the <i>tablename</i> table.
}
syntaxreq {H42833} {} {
  The following rules regarding default collating sequences and
  sort order for indices applies both to indices created by CREATE INDEX
  statements
  and also by UNIQUE or PRIMARY KEY constraints on the table definition.
} {
  The collating sequence for each column of an index shall be the
  collating sequence specified in the <i>indexlist</i>.
}
syntaxreq {H42836} {} {} {
  If an index column does not specify a collating sequence then
................................................................................
  the default collating sequence of the corresponding table column.
}
syntaxreq {H42839} {} {} {
  The sort order for an index column shall be descending if and only
  if the DESC keyword is used in the <i>indexlist</i> entry for that
  term.
}
syntaxreq {H42842} {} {} {
  The preparation of a CREATE INDEX statement shall fail with an error
  if the <i>tablename</i> refers to a system table.
}

</tcl>

<h3>2.4 DROP INDEX</h3>

<tcl>
syntaxreq {H42900} {} {} {
  The SQLite parser shall accept DROP INDEX statements 
  that conform to the following syntax:
} {
  cmd ::= DROP INDEX ifexists fullname.
}
syntaxreq {H42910} {} {} {
  The preparation of a DROP INDEX statement shall fail with an
  error if the statement lacks an IF EXISTS clause and the
  <i>fullname</i> does not reference a existing index.
}
syntaxreq {H42913} {} {} {
  The evaluation of a DROP INDEX statement shall be a silent no-op
  if the the statement has an IF EXISTS clause and the
  <i>fullname</i> does not reference a existing index.
}
syntaxreq {H42916} {} {} {
  The successful evaluation of a DROP INDEX statement shall cause
  the index identified by <i>fullname</i> to be removed from its
  database and discarded.
}
</tcl>

<h3>2.5 CREATE VIEW</h3>

<tcl>
syntaxreq {H43100} {} {} {
  The SQLite parser shall accept CREATE VIEW statements 
  that conform to the following syntax:
} {
  cmd ::= CREATE temp VIEW ifnotexists fullname AS select.
}
syntaxreq {H43113} {} {} {
  When the TEMP keyword appears in a CREATE VIEW statement and the
  <i>databasename</i> exists and is something other than "temp", then
  the preparation of the CREATE VIEW statement shall fail with an error.
}
syntaxreq {H43116} {} {} {
  When the TEMP keyword appears in a CREATE VIEW statement the behavior
  shall be as if the <i>databasename</i> where "temp".
}
syntaxreq {H43119} {} {} {
  The successful evaluation of a CREATE VIEW statement shall cause
  a new view whose name is given by the <i>objectname</i> and is located
  in the schema of the database whose name is given by the
  <i>databasename</i>.
}
syntaxreq {H43122} {} {} {
  If a CREATE VIEW statement specifies no <i>databasename</i> and omits
  the TEMP keyword then the behavior shall be as if a <i>databasename</i>
  of "main" where used.
}
syntaxreq {H43125} {} {} {
  The preparation of a CREATE VIEW statement shall fail with an 
  error if the IF NOT EXISTS clause is omitted and the <i>objectname</i>
  is the same as the name of a table or view
  in the same database.
}
syntaxreq {H43128} {} {} {
  The evaluation of a CREATE VIEW statement shall be a silent no-op if the
  IF NOT EXISTS clause is present and the <i>objectname</i>
  is the same as the name of a table or view
  in the same database.
}
syntaxreq {H43131} {} {} {
  The preparation of a CREATE VIEW statement shall fail with an error if the
  the <i>objectname</i> is the same as the name of an index
  in any database attached to the same [database connection].
}
syntaxreq {H43234} {} {} {
  The preparation of a CREATE VIEW statement shall fail with an error if the
  the <i>databasename</i> references a database that is not
  attached to the same [database connection].
}
syntaxreq {H43237} {} {} {
  The view generated by a CREATE VIEW statement shall have the
  same number of columns as the result set of the SELECT.
}
syntaxreq {H43241} {} {} {
  The names of the columns in a view generated by a CREATE VIEW
  statement shall have base names which are the names of the columns
  in the result set of the SELECT statement
}
syntaxreq {H43244} {} {} {
  Each column name in a table generated by a CREATE VIEW
  statement shall have an arbitrary suffix appended to its basename
  if and only if such a suffix is necessary to make the name
  distinct from all preceding column names in the view.
}
</tcl>

<h3>2.6 DROP VIEW</h3>

<tcl>
syntaxreq {H43200} {} {} {
  The SQLite parser shall accept DROP VIEW statements
  that conform to the following syntax:
} {
  cmd ::= DROP VIEW ifexists fullname.
}
syntaxreq {H43204} {} {} {
  The preparation of a DROP VIEW statement shall fail with an
  error if the statement lacks an IF EXISTS clause and the
  <i>fullname</i> does not reference a existing view.
}
syntaxreq {H43207} {} {} {
  The evaluation of a DROP VIEW statement shall be a silent no-op
  if the the statement has an IF EXISTS clause and the
  <i>fullname</i> does not reference a existing view.
}
syntaxreq {H43211} {} {} {
  The successful evaluation of a DROP VIEW statement shall cause
  the view identified by <i>fullname</i> to be removed from its
  database and discarded.
}
syntaxreq {H43214} {} {} {
  The successful evaluation of a DROP VIEW statement shall cause
  all triggers attached to the view identified by <i>fullname</i>
  to be removed from their database and discarded.
}
</tcl>

<h3>2.7 CREATE TRIGGER</h3>

<tcl>
syntaxreq {H43300} {} {} {
  The SQLite parser shall accept CREATE TRIGGER statements
  that conform to the following syntax:
} {
  cmd ::= CREATE temp TRIGGER ifnotexists fullname trigger trigger_body.
  trigger ::= trigger_time trigger_event foreach_clause when_clause.
  trigger_body ::= BEGIN trigger_cmd_list END.
  trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI.
  trigger_cmd_list ::=.
  trigger_cmd ::= DELETE FROM tablename where.
  trigger_cmd ::= update_cmd tablename SET setlist where.
  trigger_cmd ::= insert_cmd INTO tablename inscollist_opt VALUES LP exprlist RP.
  trigger_cmd ::= insert_cmd INTO tablename inscollist_opt select.
  trigger_cmd ::= select.
  trigger_event ::= DELETE ON trigger_target.
  trigger_event ::= INSERT ON trigger_target.
  trigger_event ::= UPDATE OF inscollist ON trigger_target.
  trigger_event ::= UPDATE ON trigger_target.
  trigger_target ::= fullname.
  trigger_time ::= AFTER.
  trigger_time ::= BEFORE.
  trigger_time ::= INSTEAD OF.
  trigger_time ::=.
  foreach_clause ::= FOR EACH ROW.
  foreach_clause ::=.
  when_clause ::= WHEN expr.
  when_clause ::=.
}
syntaxreq {H43303} {} {} {
  When the TEMP keyword appears in a CREATE TRIGGER statement and the
  <i>databasename</i> of the <i>fullname</i> exists
  then the preparation of the statement
  shall fail with an error.
}
syntaxreq {H43306} {} {} {
  When the TEMP keyword appears in a CREATE TRIGGER statement 
  the target database of the trigger shall be "temp".
}
syntaxreq {H43309} {} {} {
  When the TEMP keyword is omitted in a CREATE TRIGGER statement and the
  <i>databasename</i> of the <i>fullname</i> is
  omitted then the target database of the trigger shall be "main".
}
syntaxreq {H43312} {} {} {
  When the <i>databasename</i> of <i>fullname</i> in a CREATE TRIGGER
  statement exists, then the target database shall be the database
  named by <i>databasename</i>.
}
syntaxreq {H43315} {} {} {
  If a CREATE TRIGGER does not specify a <i>trigger_time</i> then
  the <i>trigger_time</i> shall be BEFORE.
}
syntaxreq {H43318} {} {
  An INSTEAD OF trigger may be used only on views.  Other kinds of triggers
  may be used on tables only.
} {
  The preparation of a CREATE TRIGGER statement shall fail with an error
  the <i>trigger_time</i> is INSTEAD OF and <i>trigger_target</i> is not
  the name of view in the target database.
}
syntaxreq {H43321} {} {} {
  The preparation of a CREATE TRIGGER statement shall fail with an error
  the <i>trigger_time</i> is not INSTEAD OF and <i>trigger_target</i> is not
  the name of an ordinary table in the target database.
}
syntaxreq {H43324} {} {} {
  The preparation of a CREATE TRIGGER statement shall fail with an error
  if the <i>trigger_target</i> is a system table.
}

</tcl>


<h3>2.8 DROP TRIGGER</h3>

<tcl>
syntaxreq {H43500} {} {} {
  The SQLite parser shall accept DROP TRIGGER statements
  that conform to the following syntax:
} {
  cmd ::= DROP TRIGGER ifexists fullname.
}
syntaxreq {H43504} {} {} {
  The preparation of a DROP TRIGGER statement shall fail with an
  error if the statement lacks an IF EXISTS clause and the
  <i>fullname</i> does not reference a existing trigger.
}
syntaxreq {H43507} {} {} {
  The evaluation of a DROP TRIGGER statement shall be a silent no-op
  if the the statement has an IF EXISTS clause and the
  <i>fullname</i> does not reference a existing trigger.
}
syntaxreq {H43511} {} {} {
  The successful evaluation of a DROP TRIGGER statement shall cause
  the trigger identified by <i>fullname</i> to be removed from its
  database and discarded.
}
syntaxreq {H43514} {} {} {
  The successful evaluation of a DROP TRIGGER statement shall cause
  all triggers attached to the trigger identified by <i>fullname</i>
  to be removed from their database and discarded.
}
</tcl>

<h3>2.9 CREATE VIRTUAL TABLE</h3>

<tcl>
syntaxreq {H43600} {} {} {
  The SQLite parser shall accept CREATE VIRTUAL TABLE statements
................................................................................

<h4>3.1.1 INSERT VALUE</h4>
<tcl>
syntaxreq {H43810} {} {} {
  The SQLite parser shall accept INSERT VALUE statements that
  conform to the following syntax:
} {
  cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP exprlist RP.
  insert_cmd ::= INSERT.
  insert_cmd ::= REPLACE.
  insert_cmd ::= INSERT OR REPLACE.
  insert_cmd ::= INSERT OR IGNORE.
  insert_cmd ::= INSERT OR ABORT.
  insert_cmd ::= INSERT OR FAIL.
  insert_cmd ::= INSERT OR ROLLBACK.
  inscollist_opt ::= .
  inscollist_opt ::= LP inscollist RP.
  inscollist ::= columnname.
  inscollist ::= inscollist COMMA columnname.
}
</tcl>
<h4>3.1.3 INSERT DEFAULT</h4>
<tcl>
syntaxreq {H43820} {} {} {
  The SQLite parser shall accept INSERT DEFAULT statements that
  conform to the following syntax:
................................................................................
}
</tcl>
<h4>3.1.3 INSERT SELECT</h4>
syntaxreq {H43830} {} {} {
  The SQLite parser shall accept INSERT SELECT statements that
  conform to the following syntax:
} {
  cmd ::= insert_cmd INTO fullname inscollist_opt select.
}
</tcl>
<h3>3.2 DELETE</h3>

<tcl>
syntaxreq {H43900} {} {} {
  The SQLite parser shall accept DELETE statements that
  conform to the following syntax:
} {
  cmd ::= DELETE FROM fullname where.
  where ::= .
  where ::= WHERE expr.
}
</tcl>

<h3>3.3 UPDATE</h3>

<tcl>
syntaxreq {H44100} {} {} {
  The SQLite parser shall accept UPDATE statements that
  conform to the following syntax:
} {
  cmd ::= update_cmd fullname SET setlist where.
  update_cmd ::= UPDATE.
  update_cmd ::= UPDATE OR IGNORE.
  update_cmd ::= UPDATE OR REPLACE.
  update_cmd ::= UPDATE OR ABORT.
  update_cmd ::= UPDATE OR FAIL.
  update_cmd ::= UPDATE OR ROLLBACK.
  setlist ::= setting.
  setlist ::= setlist COMMA setting.
  setting ::= columnname EQ expr.
}
</tcl>

<h3>3.4 SELECT</h3>

<tcl>
syntaxreq {H45000} {} {} {
................................................................................
  cmd ::= select.
  select ::= query.
  select ::= select UNION query.
  select ::= select UNION ALL query.
  select ::= select EXCEPT query.
  select ::= select INTERSECT query.
  query ::= SELECT distinct resultset from where groupby having orderby limit.
  distinct ::= .
  distinct ::= DISTINCT.
  groupby ::= .
  groupby ::= GROUP BY exprlist.
  having ::= .
  having ::= HAVING expr.
  orderby ::= .
  orderby ::= ORDER BY exprlist.
  limit ::=.
  limit ::= LIMIT expr.
  limit ::= LIMIT expr COMMA expr.
  limit ::= LIMIT expr OFFSET expr.
  resultset ::= result.
  resultset ::= resultset COMMA result.
  result ::= STAR.
  result ::= tablename DOT STAR.
  result ::= expr as.

  from ::= .
  from ::= FROM sourceset.
  sourceset ::= source.
  sourceset ::= sourceset joinop source.
  source ::= fullname as on using.
  source ::= LP select RP as on using.
  as ::= .
................................................................................
  on ::= .
  on ::= ON expr.
  using ::= .
  using ::= USING LP idlist RP.
  joinop ::= COMMA.
  joinop ::= JOIN.
  joinop ::= JOIN_KW JOIN.
  joinop ::= JOIN_KW JOIN_KW JOIN.
  joinop ::= JOIN_KW JOIN_KW JOIN_KW JOIN.
}
</tcl>

<h2>4.0 Other Language Elements</h2>

<h3>4.1 VACUUM</h3>

................................................................................
<tcl>
syntaxreq {H46000} {} {} {
  The SQLite parser shall accept PRAGMA statements
  that conform to the following syntax:
} {
  cmd ::= PRAGMA fullname EQ DELETE.
  cmd ::= PRAGMA fullname EQ ON.
  cmd ::= PRAGMA fullname EQ name.
  cmd ::= PRAGMA fullname EQ expr.
  cmd ::= PRAGMA fullname LP name RP.
  cmd ::= PRAGMA fullname LP expr RP.
  cmd ::= PRAGMA fullname.
}
</tcl>

<h3>4.5 ATTACH</h3>

<tcl>
syntaxreq {H44500} {} {} {
  The SQLite parser shall accept ATTACH statements
  that conform to the following syntax:
} {
  cmd ::= ATTACH database_kw expr AS expr key_opt.
  database_kw ::= .
  database_kw ::= DATABASE.
  key_opt ::= .
  key_opt ::= KEY expr.
}
</tcl>

<h3>4.6 DETACH</h3>

<tcl>
syntaxreq {H44600} {} {} {
  The SQLite parser shall accept DETACH statements
  that conform to the following syntax:
} {
  cmd ::= DETACH database_kw expr.
}
</tcl>

<h3>4.7 EXPLAIN</h3>

<tcl>
syntaxreq {H44700} {} {} {
................................................................................
  expr ::= JOIN_KW.
  expr ::= LP expr RP.
  expr ::= LP select RP.
  expr ::= MINUS expr.
  expr ::= NOT expr.
  expr ::= PLUS expr.
  expr ::= RAISE LP IGNORE RP.
  expr ::= RAISE LP ABORT COMMA name RP.
  expr ::= RAISE LP FAIL COMMA name RP.
  expr ::= RAISE LP ROLLBACK COMMA name RP.
  expr ::= REGISTER.
  expr ::= VARIABLE.
  expr ::= expr AND expr.
  expr ::= expr BITAND expr.
  expr ::= expr BITOR expr.
  expr ::= expr LSHIFT expr.
  expr ::= expr RSHIFT expr.
  expr ::= expr COLLATE ids.
  expr ::= expr CONCAT expr.
  expr ::= expr EQ expr.
  expr ::= expr NE expr.
  expr ::= expr IS NOT NULL.
  expr ::= expr IS NULL.
  expr ::= expr ISNULL
  expr ::= expr NOTNULL.
  expr ::= expr LT expr.
  expr ::= expr GT expr.
  expr ::= expr GE expr.
  expr ::= expr LE expr.
  expr ::= expr NOT NULL.
  expr ::= expr OR expr.
  expr ::= expr PLUS expr.
................................................................................
  expr ::= expr NOT IN LP exprlist RP.
  expr ::= expr NOT IN LP select RP.
  expr ::= expr NOT IN fullname.
  expr ::= expr LIKE_KW expr escape.
  expr ::= expr MATCH expr escape.
  expr ::= expr NOT LIKE_KW expr escape.
  expr ::= expr NOT MATCH expr escape.
  expr ::= databasename DOT tablename DOT columnname.
  expr ::= tablename DOT columnname.
  expr ::= term.
  term ::= CTIME_KW.
  term ::= INTEGER.
  term ::= FLOAT
  term ::= BLOB.
  term ::= NULL.
  term ::= STRING.
................................................................................
  case_else ::= ELSE expr.
  case_else ::= .
  case_exprlist ::= WHEN expr THEN expr.
  case_exprlist ::= case_exprlist WHEN expr THEN expr.
  case_operand ::= expr.
  case_operand ::= .
  function_name ::= ID.
  escape ::= .
  escape ::= ESCAPE expr.
}
</tcl>

<h3>5.2 Functions</h3>
<h4>5.2.1 Core Scalar Functions</h4>
<h4>5.2.2 Date and Time Functions</h4>
<h4>5.2.3 Aggregate Functions</h4>