Appendix I: SQL-Reserved Keywords

Appendix I: SQL-Reserved Keywords

Overview

With a limited vocabulary, SQL is a relatively efficient language (compared with many other programming languages); the SQL99 standard defines about 300 keywords out of which vendors have thus far implemented only a small subset.

Oracle 9i lists over 100 keywords, IBM DB2 UDB has over 290 keywords, and Microsoft SQL Server 2000 reserves over 170 keywords. Most of the vendor-reserved keywords are found in the SQL99 standard, but many more exist. None of these reserved words should be used as a variable identifier as such use would affect portability of your SQL code. On some systems, doing so will generate an error (SQLSTATE 42939).

Asterisks appear after the vendor-supported keywords whenever they also are part of SQL standard.

Note 

In addition to keywords listed here, each vendor also has a list of keywords reserved for future use. These lists are constantly updated. Refer to the particular RDBMS documentation.

SQL99 standard reserved keywords:

ABSOLUTE

CASE

CURRENT_TIMESTAMP

ACTION

CAST

CURRENT_USER

ADD

CATALOG

CURSOR

ADMIN

CHAR

CYCLE

AFTER

CHARACTER

DATA

AGGREGATE

CHECK

DATALINK

ALIAS

CLASS

DATE

ALL

CLOB

DAY

ALLOCATE

CLOSE

DEALLOCATE

ALTER

COLLATE

DEC

AND

COLLATION

DECIMAL

ANY

COLUMN

DECLARE

ARE

COMMIT

DEFAULT

ARRAY

COMPLETION

DEFERRABLE

AS

CONDITION

DELETE

ASC

CONNECT

DEPTH

ASSERTION

CONNECTION

DEREF

AT

CONSTRAINT

DESC

AUTHORIZATION

CONSTRAINTS

DESCRIPTOR

BEFORE

CONSTRUCTOR

DIAGNOSTICS

BEGIN

CONTAINS

DICTIONARY

BINARY

CONTINUE

DISCONNECT

BIT

CORRESPONDING

DO

BLOB

CREATE

DOMAIN

BOOLEAN

CROSS

DOUBLE

BOTH

CUBE

DROP

BREADTH

CURRENT

END-EXEC

BY

CURRENT_DATE

EQUALS

CALL

CURRENT_PATH

ESCAPE

CASCADE

CURRENT_ROLE

EXCEPT

CASCADED

CURRENT_TIME

EXCEPTION

EXECUTE

INPUT

MODIFIES

EXIT

INSERT

MODIFY

EXPAND

INT

MODULE

EXPANDING

INTEGER

MONTH

FALSE

INTERSECT

NAMES

FIRST

INTERVAL

NATIONAL

FLOAT

INTO

NATURAL

FOR

IS

NCHAR

FOREIGN

ISOLATION

NCLOB

FREE

ITERATE

NEW

FROM

JOIN

NEXT

FUNCTION

KEY

NO

GENERAL

LANGUAGE

NONE

GET

LARGE

NORMALIZE

GLOBAL

LAST

NOT

GOTO

LATERAL

NULL

GROUP

LEADING

NUMERIC

GROUPING

LEAVE

OBJECT

HANDLER

LEFT

OF

HASH

LESS

OFF

HOUR

LEVEL

OLD

IDENTITY

LIKE

ON

IF

LIMIT

ONLY

IGNORE

LOCAL

OPEN

IMMEDIATE

LOCALTIME

OPERATION

IN

LOCALTIME-STAMP

OPTION

INDICATOR

LOCATOR

OR

INITIALIZE

LOOP

ORDER

INITIALLY

MATCH

ORDINALITY

INNER

MEETS

OUT

INOUT

MINUTE

OUTER

EXECUTE

INPUT

MODIFIES

EXIT

INSERT

MODIFY

EXPAND

INT

MODULE

EXPANDING

INTEGER

MONTH

FALSE

INTERSECT

NAMES

FIRST

INTERVAL

NATIONAL

FLOAT

INTO

NATURAL

FOR

IS

NCHAR

FOREIGN

ISOLATION

NCLOB

FREE

ITERATE

NEW

FROM

JOIN

NEXT

FUNCTION

KEY

NO

GENERAL

LANGUAGE

NONE

GET

LARGE

NORMALIZE

GLOBAL

LAST

NOT

GOTO

LATERAL

NULL

GROUP

LEADING

NUMERIC

GROUPING

LEAVE

OBJECT

HANDLER

LEFT

OF

HASH

LESS

OFF

HOUR

LEVEL

OLD

IDENTITY

LIKE

ON

IF

LIMIT

ONLY

IGNORE

LOCAL

OPEN

IMMEDIATE

LOCALTIME

OPERATION

IN

LOCALTIME-STAMP

OPTION

INDICATOR

LOCATOR

OR

INITIALIZE

LOOP

ORDER

INITIALLY

MATCH

ORDINALITY

INNER

MEETS

OUT

INOUT

MINUTE

OUTER

USAGE

VARYING

WITH

USER

VIEW

WRITE

USING

WHEN

YEAR

VALUE

WHENEVER

ZONE

VALUES

WHERE

 

VARIABLE

WHILE

 

Oracle 9i SQL reserved keywords:

ACCESS

DELETE *

INTO *

ADD *

DESC *

IS *

ALL *

DISTINCT *

LEVEL *

ALTER *

DROP *

LIKE *

AND *

ELSE *

LOCK

ANY *

EXCLUSIVE

LONG

AS *

EXISTS

MAXEXTENTS

ASC *

FILE

MINUS

AUDIT

FLOAT *

MLSLABEL

BETWEEN *

FOR *

MODE

BY *

FROM *

MODIFY *

CHAR *

GRANT *

NOAUDIT

CHECK *

GROUP *

NOCOMPRESS

CLUSTER

HAVING *

NOT *

COLUMN *

IDENTIFIED

NOWAIT

COMMENT

IMMEDIATE *

NULL *

COMPRESS

IN *

NUMBER

CONNECT *

INCREMENT

OF *

CREATE *

INDEX

OFFLINE

CURRENT *

INITIAL

ON *

DATE *

INSERT *

ONLINE

DECIMAL *

INTEGER *

OPTION *

DEFAULT *

INTERSECT *

OR*

ORDER *

SESSION *

UNION *

PCTFREE

SET *

UNIQUE *

PRIOR *

SHARE

UPDATE *

PRIVILEGES *

SIZE *

USER *

PUBLIC *

SMALLINT *

VALIDATE

RAW *

START *

VALUES *

RENAME

SUCCESSFUL

VARCHAR *

RESOURCE

SYNONYM

VARCHAR2

REVOKE *

SYSDATE

VIEW *

ROW *

TABLE *

WHENEVER *

ROWID

THEN *

WHERE *

ROWNUM

TO *

WITH *

ROWS *

TRIGGER *

 

SELECT *

UID

 

IBM DB2 UDB 8.1 reserved keywords:

ACQUIRE

AUX

CAST *

ADD *

AUXILIARY

CCSID

AFTER *

AVG

CHAR *

ALIAS *

BD2GENERAL

CHARACTER *

ALL *

BEFORE *

CHECK *

ALLOCATE *

BEGIN *

CLOSE *

ALLOW

BETWEEN

CLUSTER

ALTER *

BINARY *

COLLECTION

AND *

BUFFERPOOL

COLLID

ANY *

BY *

COLUMN *

AS *

CALL *

COMMENT

ASC *

CALLED

COMMIT *

ASUTIME

CAPTURE

CONCAT

AUDIT

CASCADED *

CONDITION *

AUTHORISATION *

CASE *

CONNECT *

CONNECTION *

DESCRIPTOR *

FOREIGN *

CONSTRAINT *

DETERMINISTIC

FREE *

CONTAINS *

DISALLOW

FROM *

CONTINUE *

DISCONNECT *

FULL

COUNT

DISTINCT

FUNCTION *

COUNT_BIG

DO *

GENERAL *

CREATE *

DOUBLE *

GENERATED

CROSS *

DROP *

GO

CURRENT *

DSSIZE

GOTO *

CURRENT_DATE *

DYNAMIC

GRANT

CURRENT_LC_PATH

EDITPROC

GRAPHIC

CURRENT_PATH

ELSE

GROUP *

CURRENT_SERVER

ELSEIF

HANDLER *

CURRENT_TIME *

END

HAVING

CURRENT_TIMESTAMP *

END-EXEC

HOUR *

CURRENT_TIMEZONE

ERASE

HOURS

CURRENT_USER *

ESCAPE *

IDENTIFIED

CURSOR *

EXCEPT *

IF *

DATA *

EXCEPTION *

IMMEDIATE *

DATABASE

EXCLUSIVE

IN *

DATE *

EXECUTE *

INDEX

DAY *

EXISTS

INDICATOR *

DAYS

EXIT *

INNER *

DB2SQL

EXPLAIN