Lists of Keywords

List of SQL Keywords

Fred Toussi

The HSQL Development Group

$Revision: 847 $

2012-08-06 00:10:58+0100

Table of Contents

List of SQL Standard Keywords
List of SQL Keywords Disallowed as HyperSQL Identifiers
Special Function Keywords

List of SQL Standard Keywords

According to the SQL Standard, the SQL Language keywords cannot be used as identifiers (names of database objects such as columns and tables) without quoting.

HyperSQL has two modes of operation, which are selected with the SET DATABASE SQL NAMES { TRUE | FALSE } to allow or disallow the keywords as identifiers. The default mode is FALSE and allows the use of most keywords as identifiers. Even in this mode, keywords cannot be used as USER or ROLE identifiers. When the mode is TRUE, none of the keywords listed below can be used as identifiers.

All keywords can be used with double quotes as identifiers. For example

  CREATE TABLE "ALL" ("AND" INT, "WHEN" INT)
  SELECT "AND" FROM "ALL" WHERE "WHEN" = 2020

ABS • ALL • ALLOCATE • ALTER • AND • ANY • ARE • ARRAY • AS • ASENSITIVE • ASYMMETRIC • AT • ATOMIC • AUTHORIZATION • AVG

BEGIN • BETWEEN • BIGINT • BINARY • BLOB • BOOLEAN • BOTH • BY

CALL • CALLED • CARDINALITY • CASCADED • CASE • CAST • CEIL • CEILING • CHAR • CHAR_LENGTH • CHARACTER • CHARACTER_LENGTH • CHECK • CLOB • CLOSE • COALESCE • COLLATE • COLLECT • COLUMN • COMMIT • COMPARABLE • CONDITION • CONNECT • CONSTRAINT • CONVERT • CORR • CORRESPONDING • COUNT • COVAR_POP • COVAR_SAMP • CREATE • CROSS • CUBE • CUME_DIST • CURRENT • CURRENT_CATALOG • CURRENT_DATE • CURRENT_DEFAULT_TRANSFORM_GROUP • CURRENT_PATH • CURRENT_ROLE • CURRENT_SCHEMA • CURRENT_TIME • CURRENT_TIMESTAMP • CURRENT_TRANSFORM_GROUP_FOR_TYPE • CURRENT_USER • CURSOR • CYCLE

DATE • DAY • DEALLOCATE • DEC • DECIMAL • DECLARE • DEFAULT • DELETE • DENSE_RANK • DEREF • DESCRIBE • DETERMINISTIC • DISCONNECT • DISTINCT • DO • DOUBLE • DROP • DYNAMIC

EACH • ELEMENT • ELSE • ELSEIF • END • END_EXEC • ESCAPE • EVERY • EXCEPT • EXEC • EXECUTE • EXISTS • EXIT • EXP • EXTERNAL • EXTRACT

FALSE • FETCH • FILTER • FIRST_VALUE • FLOAT • FLOOR • FOR • FOREIGN • FREE • FROM • FULL • FUNCTION • FUSION

GET • GLOBAL • GRANT • GROUP • GROUPING

HANDLER • HAVING • HOLD • HOUR

IDENTITY • IN • INDICATOR • INNER • INOUT • INSENSITIVE • INSERT • INT • INTEGER • INTERSECT • INTERSECTION • INTERVAL • INTO • IS • ITERATE

JOIN

LAG

LANGUAGE • LARGE • LAST_VALUE • LATERAL • LEAD • LEADING • LEAVE • LEFT • LIKE • LIKE_REGEX • LN • LOCAL • LOCALTIME • LOCALTIMESTAMP • LOOP • LOWER

MATCH • MAX • MAX_CARDINALITY • MEMBER • MERGE • METHOD • MIN • MINUTE • MOD • MODIFIES • MODULE • MONTH • MULTISET

NATIONAL • NATURAL • NCHAR • NCLOB • NEW • NO • NONE • NORMALIZE • NOT • NTH_VALUE • NTILE • NULL • NULLIF • NUMERIC

OCCURRENCES_REGEX • OCTET_LENGTH • OF • OFFSET • OLD • ON • ONLY • OPEN • OR • ORDER • OUT • OUTER • OVER • OVERLAPS • OVERLAY

PARAMETER • PARTITION • PERCENT_RANK • PERCENTILE_CONT • PERCENTILE_DISC • POSITION • POSITION_REGEX • POWER • PRECISION • PREPARE • PRIMARY • PROCEDURE

RANGE • RANK • READS • REAL • RECURSIVE • REF • REFERENCES • REFERENCING • REGR_AVGX • REGR_AVGY • REGR_COUNT • REGR_INTERCEPT • REGR_R2 • REGR_SLOPE • REGR_SXX • REGR_SXY • REGR_SYY • RELEASE • REPEAT • RESIGNAL • RESULT • RETURN • RETURNS • REVOKE • RIGHT • ROLLBACK • ROLLUP • ROW • ROW_NUMBER • ROWS

SAVEPOINT • SCOPE • SCROLL • SEARCH • SECOND • SELECT • SENSITIVE • SESSION_USER • SET • SIGNAL • SIMILAR • SMALLINT • SOME • SPECIFIC • SPECIFICTYPE • SQL • SQLEXCEPTION • SQLSTATE • SQLWARNING • SQRT • STACKED • START • STATIC • STDDEV_POP • STDDEV_SAMP • SUBMULTISET • SUBSTRING • SUBSTRING_REGEX • SUM • SYMMETRIC • SYSTEM • SYSTEM_USER

TABLE • TABLESAMPLE • THEN • TIME • TIMESTAMP • TIMEZONE_HOUR • TIMEZONE_MINUTE • TO • TRAILING • TRANSLATE • TRANSLATE_REGEX • TRANSLATION • TREAT • TRIGGER • TRIM • TRIM_ARRAY • TRUE • TRUNCATE

UESCAPE • UNDO • UNION • UNIQUE • UNKNOWN • UNNEST • UNTIL • UPDATE • UPPER • USER • USING

VALUE • VALUES • VAR_POP • VAR_SAMP • VARBINARY • VARCHAR • VARYING

WHEN • WHENEVER • WHERE • WIDTH_BUCKET • WINDOW • WITH • WITHIN • WITHOUT • WHILE

YEAR

List of SQL Keywords Disallowed as HyperSQL Identifiers

When the default SET DATABASE SQL NAMES FALSE mode is used, only a subset of SQL Standard keywords cannot be used as HyperSQL identifiers. The keywords are as follows:

ALL • AND • ANY • AS • AT • AVG

BETWEEN • BOTH • BY

CALL • CASE • CAST • COALESCE • CORRESPONDING • CONVERT • COUNT • CREATE • CROSS

DEFAULT • DISTINCT • DROP

ELSE • END • EVERY • EXISTS • EXCEPT

FOR • FROM • FULL

GRANT • GROUP

HAVING

IN • INNER • INTERSECT • INTO • IS

JOIN

LEFT • LEADING • LIKE

MAX • MIN

NATURAL • NOT • NULLIF

ON • ORDER • OR • OUTER

PRIMARY

REFERENCES • RIGHT

SELECT • SET • SOME • STDDEV_POP • STDDEV_SAMP • SUM

TABLE • THEN • TO • TRAILING • TRIGGER

UNION • UNIQUE • USING

VALUES • VAR_POP • VAR_SAMP

WHEN • WHERE • WITH

Special Function Keywords

HyperSQL supports SQL Standard functions that are called without parentheses. These functions include CURRENT_DATE, LOCALTIMESTAMP, TIMEZONE_HOUR, USER, etc. When the default SET DATABASE SQL NAMES FALSE mode is used, keywords that are names of SQL functions can be used as column names without double quotes in CREATE TABLE statements . But when the identifier is a column name and is referenced in SELECT or other statements, the keywords must be double quoted. Otherwise the result of the SQL function is returned instead of the column value.

HyperSQL also supports non-standard functions SYSTIMESTAMP, CURDATE, CURTIME, TODAY, SYSDATE and NOW which can be called with or without parentheses ( e.g. NOW() or NOW ). These names can be used as column names, but the names must be double quoted in SELECT and other statements.


$Revision: 4864 $