Lists of Keywords

List of SQL Keywords

Fred Toussi

The HSQL Development Group

$Revision: 847 $

2024-10-25

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 reserved 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 unquoted 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" = 2022

ABS • ABSENT • ACOS • ALL • ALLOCATE • ALTER • AND • ANY • ANY_VALUE • ARE • ARRAY • ARRAY_AGG • ARRAY_MAX_CARDINALITY • AS • ASENSITIVE • ASIN • ASYMMETRIC • AT • ATAN • ATOMIC • AUTHORIZATION • AVG

BEGIN • BEGIN_FRAME • BEGIN_PARTITION • BETWEEN • BIGINT • BINARY • BIT_LENGTH • BLOB • BOOLEAN • BOTH • BY

CALL • CALLED • CARDINALITY • CASCADED • CASE • CAST • CEIL • CEILING • CHAR • CHARACTER • CHARACTER_LENGTH • CHAR_LENGTH • CHECK • CLOB • CLOSE • COALESCE • COLLATE • COLLECT • COLUMN • COMMIT • COMPARABLE • CONDIITON • CONNECT • CONSTRAINT • CONTAINS • CONVERT • CORR • CORRESPONDING • COS • COSH • COUNT • COVAR_POP • COVAR_SAMP • CREATE • CROSS • CUBE • CUME_DIST • CURRENT • CURRENT_CATALOG • CURRENT_DATE • CURRENT_DEFAULT_TRANSFORM_GROUP • CURRENT_PATH • CURRENT_ROLE • CURRENT_ROW • 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 • EMPTY • END • END_EXEC • END_FRAME • END_PARTITION • EQUALS • ESCAPE • EVERY • EXCEPT • EXEC • EXECUTE • EXISTS • EXIT • EXP • EXTERNAL • EXTRACT

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

GET • GLOBAL • GRANT • GROUP • GROUPING • GROUPS

HANDLER • HAVING • HOLD • HOUR

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

JOIN • JSON • JSON_ARRAY • JSON_ARRAYAGG • JSON_EXISTS • JSON_OBJECT • JSON_OBJECTAGG • JSON_QUERY • JSON_TABLE • JSON_VALUE

LAG • LANGUAGE • LARGE • LAST_VALUE • LATERAL • LEAD • LEADING • LEAST • LEAVE • LEFT • LIKE • LIKE_REGX • LISTAGG • LN • LOCAL • LOCALTIME • LOCALTIMESTAMP • LOG • LOG10 • LOOP • LOWER • LPAD • LTRIM

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 • OMIT • ON • ONLY • OPEN • OR • ORDER • OUT • OUTER • OVER • OVERLAPS • OVERLAY

PARAMETER • PARTITION • PERCENTILE_CONT • PERCENTILE_DISC • PERCENT_RANK • PERIOD • POSITION • POSITION_REGEX • POWER • PRECEDES • 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 • ROWS • ROW_NUMBER • RPAD • RTRIM

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

TABLE • TABLESAMPLE • TAN • TANH • 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 • VALUE_OF • VARBINARY • VARCHAR • VARYING • VAR_POP • VAR_SAMP • VERSIONING

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

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 • ARRAY • AS • AT

BETWEEN • BOTH • BY

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

DEFAULT • DISTINCT • DO • DROP

ELSE • EVERY • EXCEPT • EXISTS

FETCH • FOR • FROM • FULL

GRANT • GROUP • GROUPING

HAVING

IN • INNER • INTERSECT • INTO • IS

JOIN

LEADING • LEFT • LIKE

MAX • MIN

NATURAL • NOT • NULLIF

ON • OR • ORDER • OUTER

PRIMARY

REFERENCES • RIGHT • ROLLUP

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: 6787 $