Keywords
This topic describes non-reserved keywords and reserved keywords. It provides a list of reserved keywords in StarRocks.
Introduction
Keywords in SQL statements, such as CREATE
and DROP
, have special meanings when parsed by StarRocks. Keywords are classified into non-reserved keywords and reserved keywords.
-
Non-reserved keywords can be directly used as identifiers without special treatment, such as table names and column names. For example,
DB
is a non-reserved keyword. You can create a database namedDB
.CREATE DATABASE DB;
Query OK, 0 rows affected (0.00 sec) -
Reserved keywords can be used as identifiers only after special treatment. For example,
LIKE
is a reserved keyword. If you want to use it to identify a database, enclose it in a pair of backticks (`).CREATE DATABASE `LIKE`;
Query OK, 0 rows affected (0.01 sec)If it is not enclosed in backticks, an error is returned:
CREATE DATABASE LIKE;
ERROR 1064 (HY000): Getting syntax error at line 1, column 16. Detail message: Unexpected input 'like', the most similar input is {a legal identifier}.
Reserved keywords
Following are StarRocks reserved keywords arranged in alphabetical order. You must enclose them in a pair of backticks (`) if you want to use them as identifiers. The reserved keywords may vary with StarRocks versions.
A
- ADD
- ALL
- ALTER
- ANALYZE
- AND
- ARRAY
- AS
- ASC
B
- BETWEEN
- BIGINT
- BITMAP
- BOTH
- BY
C
- CASE
- CHAR
- CHARACTER
- CHECK
- COLLATE
- COLUMN
- COMPACTION (v3.1 and later)
- CONVERT
- CREATE
- CROSS
- CUBE
- CURRENT_DATE
- CURRENT_TIME
- CURRENT_TIMESTAMP
- CURRENT_USER
- CURRENT_ROLE (v3.0 and later)
D
- DATABASE
- DATABASES
- DECIMAL
- DECIMALV2
- DECIMAL32
- DECIMAL64
- DECIMAL128
- DEFAULT
- DELETE
- DENSE_RANK
- DESC
- DESCRIBE
- DISTINCT
- DOUBLE
- DROP
- DUAL
- DEFERRED (v3.0 and later)
E
- ELSE
- EXCEPT
- EXISTS
- EXPLAIN
F
- FALSE
- FIRST_VALUE
- FLOAT
- FOR
- FORCE
- FROM
- FULL
- FUNCTION
G
- GRANT
- GROUP
- GROUPS
- GROUPING
- GROUPING_ID
H
- HAVING
- HLL
- HOST
I
- IF
- IGNORE
- IN
- INDEX
- INFILE
- INNER
- INSERT
- INT
- INTEGER
- INTERSECT
- INTO
- IS
- IMMEDIATE (v3.0 and later)
J
- JOIN
- JSON
K
- KEY
- KEYS
- KILL
L
- LAG
- LARGEINT
- LAST_VALUE
- LATERAL
- LEAD
- LEFT
- LIKE
- LIMIT
- LOAD
- LOCALTIME
- LOCALTIMESTAMP
M
- MAXVALUE
- MINUS
- MOD
N
- NTILE
- NOT
- NULL
O
- ON
- OR
- ORDER
- OUTER
- OUTFILE
- OVER
P
- PARTITION
- PERCENTILE
- PRIMARY
- PROCEDURE
Q
- QUALIFY
R
- RANGE
- RANK
- READ
- REGEXP
- RELEASE
- RENAME
- REPLACE
- REVOKE
- RIGHT
- RLIKE
- ROW
- ROWS
- ROW_NUMBER
S
- SCHEMA
- SCHEMAS
- SELECT
- SET
- SET_VAR
- SHOW
- SMALLINT
- SYSTEM
T
- TABLE
- TERMINATED
- TEXT (v3.1 and later)
- THEN
- TINYINT
- TO
- TRUE
U
- UNION
- UNIQUE
- UNSIGNED
- UPDATE
- USE
- USING
V
- VALUES
- VARCHAR
W
- WHEN
- WHERE
- WITH