summaryrefslogtreecommitdiff
path: root/etc/sql-reserved-words.txt
blob: 553eda2824ca8eabbb4642ea29a9c28322f00cdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
The data below is wrong/incomplete, see:
PG8.3 - http://www.postgresql.org/docs/8.3/static/sql-keywords-appendix.html
MySQL5.6 - http://dev.mysql.com/doc/refman/5.6/en/reserved-words.html
-------------------------------------------------------------------------------


From http://epoch.cs.berkeley.edu:8000/sequoia/dba/montage/FAQ/SQL.html
  by Jean Anderson (jta@postgres.berkeley.edu)

What are the SQL reserved words? 

I grep'd the following list out of the sql docs available via anonymous ftp to speckle.ncsl.nist.gov:/isowg3.
SQL3 words are not set in stone, but you'd do well to avoid them. 

    From sql1992.txt:

         AFTER, ALIAS, ASYNC, BEFORE, BOOLEAN, BREADTH,
         COMPLETION, CALL, CYCLE, DATA, DEPTH, DICTIONARY, EACH, ELSEIF,
         EQUALS, GENERAL, IF, IGNORE, LEAVE, LESS, LIMIT, LOOP, MODIFY,
         NEW, NONE, OBJECT, OFF, OID, OLD, OPERATION, OPERATORS, OTHERS,
         PARAMETERS, PENDANT, PREORDER, PRIVATE, PROTECTED, RECURSIVE, REF,
         REFERENCING, REPLACE, RESIGNAL, RETURN, RETURNS, ROLE, ROUTINE,
         ROW, SAVEPOINT, SEARCH, SENSITIVE, SEQUENCE, SIGNAL, SIMILAR,
         SQLEXCEPTION, SQLWARNING, STRUCTURE, TEST, THERE, TRIGGER, TYPE,
         UNDER, VARIABLE, VIRTUAL, VISIBLE, WAIT, WHILE, WITHOUT

    From sql1992.txt (Annex E):

         ABSOLUTE, ACTION, ADD, ALLOCATE, ALTER, ARE, ASSERTION, AT, BETWEEN,
         BIT, BIT

What are the SQL reserved words? 

I grep'd the following list out of the sql docs available via anonymous ftp to speckle.ncsl.nist.gov:/isowg3.
SQL3 words are not set in stone, but you'd do well to avoid them. 

    From sql1992.txt:

         AFTER, ALIAS, ASYNC, BEFORE, BOOLEAN, BREADTH,
         COMPLETION, CALL, CYCLE, DATA, DEPTH, DICTIONARY, EACH, ELSEIF,
         EQUALS, GENERAL, IF, IGNORE, LEAVE, LESS, LIMIT, LOOP, MODIFY,
         NEW, NONE, OBJECT, OFF, OID, OLD, OPERATION, OPERATORS, OTHERS,
         PARAMETERS, PENDANT, PREORDER, PRIVATE, PROTECTED, RECURSIVE, REF,
         REFERENCING, REPLACE, RESIGNAL, RETURN, RETURNS, ROLE, ROUTINE,
         ROW, SAVEPOINT, SEARCH, SENSITIVE, SEQUENCE, SIGNAL, SIMILAR,
         SQLEXCEPTION, SQLWARNING, STRUCTURE, TEST, THERE, TRIGGER, TYPE,
         UNDER, VARIABLE, VIRTUAL, VISIBLE, WAIT, WHILE, WITHOUT

    From sql1992.txt (Annex E):

         ABSOLUTE, ACTION, ADD, ALLOCATE, ALTER, ARE, ASSERTION, AT, BETWEEN,
         BIT, BIT

What are the SQL reserved words? 

I grep'd the following list out of the sql docs available via anonymous ftp to speckle.ncsl.nist.gov:/isowg3.
SQL3 words are not set in stone, but you'd do well to avoid them. 

    From sql1992.txt:

         AFTER, ALIAS, ASYNC, BEFORE, BOOLEAN, BREADTH,
         COMPLETION, CALL, CYCLE, DATA, DEPTH, DICTIONARY, EACH, ELSEIF,
         EQUALS, GENERAL, IF, IGNORE, LEAVE, LESS, LIMIT, LOOP, MODIFY,
         NEW, NONE, OBJECT, OFF, OID, OLD, OPERATION, OPERATORS, OTHERS,
         PARAMETERS, PENDANT, PREORDER, PRIVATE, PROTECTED, RECURSIVE, REF,
         REFERENCING, REPLACE, RESIGNAL, RETURN, RETURNS, ROLE, ROUTINE,
         ROW, SAVEPOINT, SEARCH, SENSITIVE, SEQUENCE, SIGNAL, SIMILAR,
         SQLEXCEPTION, SQLWARNING, STRUCTURE, TEST, THERE, TRIGGER, TYPE,
         UNDER, VARIABLE, VIRTUAL, VISIBLE, WAIT, WHILE, WITHOUT

    From sql1992.txt (Annex E):

         ABSOLUTE, ACTION, ADD, ALLOCATE, ALTER, ARE, ASSERTION, AT, BETWEEN,
         BIT, BIT_LENGTH, BOTH, CASCADE, CASCADED, CASE, CAST, CATALOG,
         CHAR_LENGTH, CHARACTER_LENGTH, COALESCE, COLLATE, COLLATION, COLUMN,
         CONNECT, CONNECTION, CONSTRAINT, CONSTRAINTS, CONVERT, CORRESPONDING,
         CROSS, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP, CURRENT_USER,
         DATE, DAY, DEALLOCATE, DEFERRABLE, DEFERRED, DESCRIBE, DESCRIPTOR,
         DIAGNOSTICS, DISCONNECT, DOMAIN, DROP, ELSE, END-EXEC, EXCEPT,
         EXCEPTION, EXECUTE, EXTERNAL, EXTRACT, FALSE, FIRST, FULL, GET,
         GLOBAL, HOUR, IDENTITY, IMMEDIATE, INITIALLY, INNER, INPUT,
         INSENSITIVE, INTERSECT, INTERVAL, ISOLATION, JOIN, LAST, LEADING,
         LEFT, LEVEL, LOCAL, LOWER, MATCH, MINUTE, MONTH, NAMES, NATIONAL,
         NATURAL, NCHAR, NEXT, NO, NULLIF, OCTET_LENGTH, ONLY, OUTER, OUTPUT,
         OVERLAPS, PAD, PARTIAL, POSITION, PREPARE, PRESERVE, PRIOR, READ,
         RELATIVE, RESTRICT, REVOKE, RIGHT, ROWS, SCROLL, SECOND, SESSION,
         SESSION_USER, SIZE, SPACE, SQLSTATE, SUBSTRING, SYSTEM_USER,
         TEMPORARY, THEN, TIME, TIMESTAMP, TIMEZONE_HOUR, TIMEZONE_MINUTE,
         TRAILING, TRANSACTION, TRANSLATE, TRANSLATION, TRIM, TRUE, UNKNOWN,
         UPPER, USAGE, USING, VALUE, VARCHAR, VARYING, WHEN, WRITE, YEAR, ZONE

    From sql3part2.txt (Annex E)

         ACTION, ACTOR, AFTER, ALIAS, ASYNC, ATTRIBUTES, BEFORE, BOOLEAN,
         BREADTH, COMPLETION, CURRENT_PATH, CYCLE, DATA, DEPTH, DESTROY,
         DICTIONARY, EACH, ELEMENT, ELSEIF, EQUALS, FACTOR, GENERAL, HOLD,
         IGNORE, INSTEAD, LESS, LIMIT, LIST, MODIFY, NEW, NEW_TABLE, NO,
         NONE, OFF, OID, OLD, OLD_TABLE, OPERATION, OPERATOR, OPERATORS,
         PARAMETERS, PATH, PENDANT, POSTFIX, PREFIX, PREORDER, PRIVATE,
         PROTECTED, RECURSIVE, REFERENCING, REPLACE, ROLE, ROUTINE, ROW,
         SAVEPOINT, SEARCH, SENSITIVE, SEQUENCE, SESSION, SIMILAR, SPACE,
         SQLEXCEPTION, SQLWARNING, START, STATE, STRUCTURE, SYMBOL, TERM,
         TEST, THERE, TRIGGER, TYPE, UNDER, VARIABLE, VIRTUAL, VISIBLE,
         WAIT, WITHOUT

    sql3part4.txt (ANNEX E):

         CALL, DO, ELSEIF, EXCEPTION, IF, LEAVE, LOOP, OTHERS, RESIGNAL,
         RETURN, RETURNS, SIGNAL, TUPLE, WHILE

from http://dev.mysql.com/doc/refman/5.6/en/reserved-words.html

ACCESSIBLE 	ADD 	ALL
ALTER 	ANALYZE 	AND
AS 	ASC 	ASENSITIVE
BEFORE 	BETWEEN 	BIGINT
BINARY 	BLOB 	BOTH
BY 	CALL 	CASCADE
CASE 	CHANGE 	CHAR
CHARACTER 	CHECK 	COLLATE
COLUMN 	CONDITION 	CONSTRAINT
CONTINUE 	CONVERT 	CREATE
CROSS 	CURRENT_DATE 	CURRENT_TIME
CURRENT_TIMESTAMP 	CURRENT_USER 	CURSOR
DATABASE 	DATABASES 	DAY_HOUR
DAY_MICROSECOND 	DAY_MINUTE 	DAY_SECOND
DEC 	DECIMAL 	DECLARE
DEFAULT 	DELAYED 	DELETE
DESC 	DESCRIBE 	DETERMINISTIC
DISTINCT 	DISTINCTROW 	DIV
DOUBLE 	DROP 	DUAL
EACH 	ELSE 	ELSEIF
ENCLOSED 	ESCAPED 	EXISTS
EXIT 	EXPLAIN 	FALSE
FETCH 	FLOAT 	FLOAT4
FLOAT8 	FOR 	FORCE
FOREIGN 	FROM 	FULLTEXT
GENERAL 	GRANT 	GROUP
HAVING 	HIGH_PRIORITY 	HOUR_MICROSECOND
HOUR_MINUTE 	HOUR_SECOND 	IF
IGNORE 	IGNORE_SERVER_IDS 	IN
INDEX 	INFILE 	INNER
INOUT 	INSENSITIVE 	INSERT
INT 	INT1 	INT2
INT3 	INT4 	INT8
INTEGER 	INTERVAL 	INTO
IS 	ITERATE 	JOIN
KEY 	KEYS 	KILL
LEADING 	LEAVE 	LEFT
LIKE 	LIMIT 	LINEAR
LINES 	LOAD 	LOCALTIME
LOCALTIMESTAMP 	LOCK 	LONG
LONGBLOB 	LONGTEXT 	LOOP
LOW_PRIORITY 	MASTER_HEARTBEAT_PERIOD 	MASTER_SSL_VERIFY_SERVER_CERT
MATCH 	MAXVALUE 	MEDIUMBLOB
MEDIUMINT 	MEDIUMTEXT 	MIDDLEINT
MINUTE_MICROSECOND 	MINUTE_SECOND 	MOD
MODIFIES 	NATURAL 	NOT
NO_WRITE_TO_BINLOG 	NULL 	NUMERIC
ON 	OPTIMIZE 	OPTION
OPTIONALLY 	OR 	ORDER
OUT 	OUTER 	OUTFILE
PRECISION 	PRIMARY 	PROCEDURE
PURGE 	RANGE 	READ
READS 	READ_WRITE 	REAL
REFERENCES 	REGEXP 	RELEASE
RENAME 	REPEAT 	REPLACE
REQUIRE 	RESIGNAL 	RESTRICT
RETURN 	REVOKE 	RIGHT
RLIKE 	SCHEMA 	SCHEMAS
SECOND_MICROSECOND 	SELECT 	SENSITIVE
SEPARATOR 	SET 	SHOW
SIGNAL 	SLOW 	SMALLINT
SPATIAL 	SPECIFIC 	SQL
SQLEXCEPTION 	SQLSTATE 	SQLWARNING
SQL_BIG_RESULT 	SQL_CALC_FOUND_ROWS 	SQL_SMALL_RESULT
SSL 	STARTING 	STRAIGHT_JOIN
TABLE 	TERMINATED 	THEN
TINYBLOB 	TINYINT 	TINYTEXT
TO 	TRAILING 	TRIGGER
TRUE 	UNDO 	UNION
UNIQUE 	UNLOCK 	UNSIGNED
UPDATE 	USAGE 	USE
USING 	UTC_DATE 	UTC_TIME
UTC_TIMESTAMP 	VALUES 	VARBINARY
VARCHAR 	VARCHARACTER 	VARYING
WHEN 	WHERE 	WHILE
WITH 	WRITE 	XOR
YEAR_MONTH 	ZEROFILL 	 

The following are new reserved words in MySQL 5.5:
GENERAL 	IGNORE_SERVER_IDS 	MASTER_HEARTBEAT_PERIOD
MAXVALUE 	RESIGNAL 	SIGNAL
SLOW 	  	 

MySQL permits some keywords to be used as unquoted identifiers because many people previously used them. Examples are those in the following list:

    *

      ACTION
    *

      BIT
    *

      DATE
    *

      ENUM
    *

      NO
    *

      TEXT
    *

      TIME
    *

      TIMESTAMP