MySQL
ORACLE
POSTGRESQL
SQL
SQL SERVER

List of SQL Reserved Words in All Major Databases

intro

Let's discover all the SQL reserved words in MySQL, PostgreSQL, SQL Server, and Oracle to become a master of SQL syntax.

Tools used in the tutorial
Tool Description Link
Dbvisualizer DBVISUALIZER
TOP RATED DATABASE MANAGEMENT TOOL AND SQL CLIENT

Reserved words are building blocks that programming languages use to define their syntax and functionality. These words are predefined by the language and have specific meanings, such as controlling flow, declaring variables, or defining functions. SQL, too, has many reserved words. Time to explore all the SQL reserved words!

In this article, you will understand what reserved SQL words are, see those of all major databases, and learn how to deal with them when writing queries.

Let's dive right in!

Reserved Words in SQL: Definition

SQL reserved words, also known as SQL reserved identifiers, are predefined words that cannot be used as identifiers. These words are part of the SQL syntax and cannot be used in names of tables, columns, or other database objects—unless they are enclosed in special delimiters like double or single quotes or backticks, depending on the SQL dialect.

List of SQL Reserved Words

The SQL:2023 ISO/ANSI standard defines a list of reserved words in SQL. At the same time, each SQL dialect also has its own set of reserved SQL words.

Let's explore the list of SQL reserved words for:

  • MySQL
  • PostgreSQL
  • SQL Server
  • Oracle

Reserved Words in MySQL

Here is the list of reserved words in MySQL:

  • ACCESSIBLE
  • ACCOUNT
  • ACTION
  • ACTIVE
  • ADD
  • ADMIN
  • AFTER
  • AGAINST
  • AGGREGATE
  • ALGORITHM
  • ALL
  • ALTER
  • ALWAYS
  • ANALYZE
  • AND
  • ANY
  • ARRAY
  • AS
  • ASC
  • ASCII
  • ASENSITIVE
  • AT
  • ATTRIBUTE
  • AUTHENTICATION
  • AUTO
  • AUTOEXTEND_SIZE
  • AUTO_INCREMENT
  • AVG
  • AVG_ROW_LENGTH
  • BACKUP
  • BEFORE
  • BEGIN
  • BERNOULLI
  • BETWEEN
  • BIGINT
  • BINARY
  • BINLOG
  • BIT
  • BLOB
  • BLOCK
  • BOOL
  • BOOLEAN
  • BOTH
  • BTREE
  • BUCKETS
  • BULK
  • BY
  • BYTE
  • CACHE
  • CALL
  • CASCADE
  • CASCADED
  • CASE
  • CATALOG_NAME
  • CHAIN
  • CHALLENGE_RESPONSE
  • CHANGE
  • CHANGED
  • CHANNEL
  • CHAR
  • CHARACTER
  • CHARSET
  • CHECK
  • CHECKSUM
  • CIPHER
  • CLASS_ORIGIN
  • CLIENT
  • CLONE
  • CLOSE
  • COALESCE
  • CODE
  • COLLATE
  • COLLATION
  • COLUMN
  • COLUMNS
  • COLUMN_FORMAT
  • COLUMN_NAME
  • COMMENT
  • COMMIT
  • COMMITTED
  • COMPACT
  • COMPLETION
  • COMPONENT
  • COMPRESSED
  • COMPRESSION
  • CONCURRENT
  • CONDITION
  • CONNECTION
  • CONSISTENT
  • CONSTRAINT
  • CONSTRAINT_CATALOG
  • CONSTRAINT_NAME
  • CONSTRAINT_SCHEMA
  • CONTAINS
  • CONTEXT
  • CONTINUE
  • CONVERT
  • CPU
  • CREATE
  • CROSS
  • CUBE
  • CUME_DIST
  • CURRENT
  • CURRENT_DATE
  • CURRENT_TIME
  • CURRENT_TIMESTAMP
  • CURRENT_USER
  • CURSOR
  • CURSOR_NAME
  • DATA
  • DATABASE
  • DATABASES
  • DATAFILE
  • DATE
  • DATETIME
  • DAY
  • DAY_HOUR
  • DAY_MICROSECOND
  • DAY_MINUTE
  • DAY_SECOND
  • DEALLOCATE
  • DEC
  • DECIMAL
  • DECLARE
  • DEFAULT
  • DEFAULT_AUTH
  • DEFINER
  • DEFINITION
  • DELAYED
  • DELAY_KEY_WRITE
  • DELETE
  • DENSE_RANK
  • DESC
  • DESCRIBE
  • DESCRIPTION
  • DETERMINISTIC
  • DIAGNOSTICS
  • DIRECTORY
  • DISABLE
  • DISCARD
  • DISK
  • DISTINCT
  • DISTINCTROW
  • DIV
  • DO
  • DOUBLE
  • DROP
  • DUAL
  • DUMPFILE
  • DUPLICATE
  • DYNAMIC
  • EACH
  • ELSE
  • ELSEIF
  • EMPTY
  • ENABLE
  • ENCLOSED
  • ENCRYPTION
  • END
  • ENDS
  • ENFORCED
  • ENGINE
  • ENGINES
  • ENGINE_ATTRIBUTE
  • ENUM
  • ERROR
  • ERRORS
  • ESCAPE
  • ESCAPED
  • EVENT
  • EVENTS
  • EVERY
  • EXCEPT
  • EXCHANGE
  • EXCLUDE
  • EXECUTE
  • EXISTS
  • EXIT
  • EXPANSION
  • EXPIRE
  • EXPLAIN
  • EXPORT
  • EXTENDED
  • EXTENT_SIZE
  • FACTOR
  • FAILED_LOGIN_ATTEMPTS
  • FALSE
  • FAST
  • FAULTS
  • FETCH
  • FIELDS
  • FILE
  • FILE_BLOCK_SIZE
  • FILTER
  • FINISH
  • FIRST
  • FIRST_VALUE
  • FIXED
  • FLOAT
  • FLOAT4
  • FLOAT8
  • FLUSH
  • FOLLOWING
  • FOLLOWS
  • FOR
  • FORCE
  • FOREIGN
  • FORMAT
  • FOUND
  • FROM
  • FULL
  • FULLTEXT
  • FUNCTION
  • GENERAL
  • GENERATE
  • GENERATED
  • GEOMCOLLECTION
  • GEOMETRY
  • GEOMETRYCOLLECTION
  • GET
  • GET_FORMAT
  • GET_SOURCE_PUBLIC_KEY
  • GLOBAL
  • GRANT
  • GRANTS
  • GROUP
  • GROUPING
  • GROUPS
  • GROUP_REPLICATION
  • GTIDS
  • GTID_ONLY
  • HANDLER
  • HASH
  • HAVING
  • HELP
  • HIGH_PRIORITY
  • HISTOGRAM
  • HISTORY
  • HOST
  • HOSTS
  • HOUR
  • HOUR_MICROSECOND
  • HOUR_MINUTE
  • HOUR_SECOND
  • IDENTIFIED
  • IF
  • IGNORE
  • IGNORE_SERVER_IDS
  • IMPORT
  • IN
  • INACTIVE
  • INDEX
  • INDEXES
  • INFILE
  • INITIAL
  • INITIAL_SIZE
  • INITIATE
  • INNER
  • INOUT
  • INSENSITIVE
  • INSERT
  • INSERT_METHOD
  • INSTALL
  • INSTANCE
  • INT
  • INT1
  • INT2
  • INT3
  • INT4
  • INT8
  • INTEGER
  • INTERSECT
  • INTERVAL
  • INTO
  • INVISIBLE
  • INVOKER
  • IO
  • IO_AFTER_GTIDS
  • IO_BEFORE_GTIDS
  • IO_THREAD
  • IPC
  • IS
  • ISOLATION
  • ISSUER
  • ITERATE
  • JOIN
  • JSON
  • JSON_TABLE
  • JSON_VALUE
  • KEY
  • KEYRING
  • KEYS
  • KEY_BLOCK_SIZE
  • KILL
  • LAG
  • LANGUAGE
  • LAST
  • LAST_VALUE
  • LATERAL
  • LEAD
  • LEADING
  • LEAVE
  • LEAVES
  • LEFT
  • LESS
  • LEVEL
  • LIKE
  • LIMIT
  • LINEAR
  • LINES
  • LINESTRING
  • LIST
  • LOAD
  • LOCAL
  • LOCALTIME
  • LOCALTIMESTAMP
  • LOCK
  • LOCKED
  • LOCKS
  • LOG
  • LOGFILE
  • LOGS
  • LONG
  • LONGBLOB
  • LONGTEXT
  • LOOP
  • LOW_PRIORITY
  • MANUAL
  • MASTER
  • MATCH
  • MAXVALUE
  • MAX_CONNECTIONS_PER_HOUR
  • MAX_QUERIES_PER_HOUR
  • MAX_ROWS
  • MAX_SIZE
  • MAX_UPDATES_PER_HOUR
  • MAX_USER_CONNECTIONS
  • MEDIUM
  • MEDIUMBLOB
  • MEDIUMINT
  • MEDIUMTEXT
  • MEMBER
  • MEMORY
  • MERGE
  • MESSAGE_TEXT
  • MICROSECOND
  • MIDDLEINT
  • MIGRATE
  • MINUTE
  • MINUTE_MICROSECOND
  • MINUTE_SECOND
  • MIN_ROWS
  • MOD
  • MODE
  • MODIFIES
  • MODIFY
  • MONTH
  • MULTILINESTRING
  • MULTIPOINT
  • MULTIPOLYGON
  • MUTEX
  • MYSQL_ERRNO
  • NAME
  • NAMES
  • NATIONAL
  • NATURAL
  • NCHAR
  • NDB
  • NDBCLUSTER
  • NESTED
  • NETWORK_NAMESPACE
  • NEVER
  • NEW
  • NEXT
  • NO
  • NODEGROUP
  • NONE
  • NOT
  • NOWAIT
  • NO_WAIT
  • NO_WRITE_TO_BINLOG
  • NTH_VALUE
  • NTILE
  • NULL
  • NULLS
  • NUMBER
  • NUMERIC
  • NVARCHAR
  • OF
  • OFF
  • OFFSET
  • OJ
  • OLD
  • ON
  • ONE
  • ONLY
  • OPEN
  • OPTIMIZE
  • OPTIMIZER_COSTS
  • OPTION
  • OPTIONAL
  • OPTIONALLY
  • OPTIONS
  • OR
  • ORDER
  • ORDINALITY
  • ORGANIZATION
  • OTHERS
  • OUT
  • OUTER
  • OUTFILE
  • OVER
  • OWNER
  • PACK_KEYS
  • PAGE
  • PARALLEL
  • PARSER
  • PARSE_TREE
  • PARTIAL
  • PARTITION
  • PARTITIONING
  • PARTITIONS
  • PASSWORD
  • PASSWORD_LOCK_TIME
  • PATH
  • PERCENT_RANK
  • PERSIST
  • PERSIST_ONLY
  • PHASE
  • PLUGIN
  • PLUGINS
  • PLUGIN_DIR
  • POINT
  • POLYGON
  • PORT
  • PRECEDES
  • PRECEDING
  • PRECISION
  • PREPARE
  • PRESERVE
  • PREV
  • PRIMARY
  • PRIVILEGES
  • PRIVILEGE_CHECKS_USER
  • PROCEDURE
  • PROCESS
  • PROCESSLIST
  • PROFILE
  • PROFILES
  • PROXY
  • PURGE
  • QUALIFY
  • QUARTER
  • QUERY
  • QUICK
  • RANDOM
  • RANGE
  • RANK
  • READ
  • READS
  • READ_ONLY
  • READ_WRITE
  • REAL
  • REBUILD
  • RECOVER
  • RECURSIVE
  • REDO_BUFFER_SIZE
  • REDUNDANT
  • REFERENCE
  • REFERENCES
  • REGEXP
  • REGISTRATION
  • RELAY
  • RELAYLOG
  • RELAY_LOG_FILE
  • RELAY_LOG_POS
  • RELAY_THREAD
  • RELEASE
  • RELOAD
  • REMOVE
  • RENAME
  • REORGANIZE
  • REPAIR
  • REPEAT
  • REPEATABLE
  • REPLACE
  • REPLICA
  • REPLICAS
  • REPLICATE_DO_DB
  • REPLICATE_DO_TABLE
  • REPLICATE_IGNORE_DB
  • REPLICATE_IGNORE_TABLE
  • REPLICATE_REWRITE_DB
  • REPLICATE_WILD_DO_TABLE
  • REPLICATE_WILD_IGNORE_TABLE
  • REPLICATION
  • REQUIRE
  • REQUIRE_ROW_FORMAT
  • RESET
  • RESIGNAL
  • RESOURCE
  • RESPECT
  • RESTART
  • RESTORE
  • RESTRICT
  • RESUME
  • RETAIN
  • RETURN
  • RETURNED_SQLSTATE
  • RETURNING
  • RETURNS
  • REUSE
  • REVERSE
  • REVOKE
  • RIGHT
  • RLIKE
  • ROLE
  • ROLLBACK
  • ROLLUP
  • ROTATE
  • ROUTINE
  • ROW
  • ROWS
  • ROW_COUNT
  • ROW_FORMAT
  • ROW_NUMBER
  • RTREE
  • S3
  • SAVEPOINT
  • SCHEDULE
  • SCHEMA
  • SCHEMAS
  • SCHEMA_NAME
  • SECOND
  • SECONDARY
  • SECONDARY_ENGINE
  • SECONDARY_ENGINE_ATTRIBUTE
  • SECONDARY_LOAD
  • SECONDARY_UNLOAD
  • SECOND_MICROSECOND
  • SECURITY
  • SELECT
  • SENSITIVE
  • SEPARATOR
  • SERIAL
  • SERIALIZABLE
  • SERVER
  • SESSION
  • SET
  • SHARE
  • SHOW
  • SHUTDOWN
  • SIGNAL
  • SIGNED
  • SIMPLE
  • SKIP
  • SLAVE
  • SLOW
  • SMALLINT
  • SNAPSHOT
  • SOCKET
  • SOME
  • SONAME
  • SOUNDS
  • SOURCE
  • SOURCE_AUTO_POSITION
  • SOURCE_BIND
  • SOURCE_COMPRESSION_ALGORITHMS
  • SOURCE_CONNECT_RETRY
  • SOURCE_DELAY
  • SOURCE_HEARTBEAT_PERIOD
  • SOURCE_HOST
  • SOURCE_LOG_FILE
  • SOURCE_LOG_POS
  • SOURCE_PASSWORD
  • SOURCE_PORT
  • SOURCE_PUBLIC_KEY_PATH
  • SOURCE_RETRY_COUNT
  • SOURCE_SSL
  • SOURCE_SSL_CA
  • SOURCE_SSL_CAPATH
  • SOURCE_SSL_CERT
  • SOURCE_SSL_CIPHER
  • SOURCE_SSL_CRL
  • SOURCE_SSL_CRLPATH
  • SOURCE_SSL_KEY
  • SOURCE_SSL_VERIFY_SERVER_CERT
  • SOURCE_TLS_CIPHERSUITES
  • SOURCE_TLS_VERSION
  • SOURCE_USER
  • SOURCE_ZSTD_COMPRESSION_LEVEL
  • SPATIAL
  • SPECIFIC
  • SQL
  • SQLEXCEPTION
  • SQLSTATE
  • SQLWARNING
  • SQL_AFTER_GTIDS
  • SQL_AFTER_MTS_GAPS
  • SQL_BEFORE_GTIDS
  • SQL_BIG_RESULT
  • SQL_BUFFER_RESULT
  • SQL_CALC_FOUND_ROWS
  • SQL_NO_CACHE
  • SQL_SMALL_RESULT
  • SQL_THREAD
  • SQL_TSI_DAY
  • SQL_TSI_HOUR
  • SQL_TSI_MINUTE
  • SQL_TSI_MONTH
  • SQL_TSI_QUARTER
  • SQL_TSI_SECOND
  • SQL_TSI_WEEK
  • SQL_TSI_YEAR
  • SRID
  • SSL
  • STACKED
  • START
  • STARTING
  • STARTS
  • STATS_AUTO_RECALC
  • STATS_PERSISTENT
  • STATS_SAMPLE_PAGES
  • STATUS
  • STOP
  • STORAGE
  • STORED
  • STRAIGHT_JOIN
  • STREAM
  • STRING
  • SUBCLASS_ORIGIN
  • SUBJECT
  • SUBPARTITION
  • SUBPARTITIONS
  • SUPER
  • SUSPEND
  • SWAPS
  • SWITCHES
  • SYSTEM
  • TABLE
  • TABLES
  • TABLESAMPLE
  • TABLESPACE
  • TABLE_CHECKSUM
  • TABLE_NAME
  • TEMPORARY
  • TEMPTABLE
  • TERMINATED
  • TEXT
  • THAN
  • THEN
  • THREAD_PRIORITY
  • TIES
  • TIME
  • TIMESTAMP
  • TIMESTAMPADD
  • TIMESTAMPDIFF
  • TINYBLOB
  • TINYINT
  • TINYTEXT
  • TLS
  • TO
  • TRAILING
  • TRANSACTION
  • TRIGGER
  • TRIGGERS
  • TRUE
  • TRUNCATE
  • TYPE
  • TYPES
  • UNBOUNDED
  • UNCOMMITTED
  • UNDEFINED
  • UNDO
  • UNDOFILE
  • UNDO_BUFFER_SIZE
  • UNICODE
  • UNINSTALL
  • UNION
  • UNIQUE
  • UNKNOWN
  • UNLOCK
  • UNREGISTER
  • UNSIGNED
  • UNTIL
  • UPDATE
  • UPGRADE
  • URL
  • USAGE
  • USE
  • USER
  • USER_RESOURCES
  • USE_FRM
  • USING
  • UTC_DATE
  • UTC_TIME
  • UTC_TIMESTAMP
  • VALIDATION
  • VALUE
  • VALUES
  • VARBINARY
  • VARCHAR
  • VARCHARACTER
  • VARIABLES
  • VARYING
  • VCPU
  • VIEW
  • VIRTUAL
  • VISIBLE
  • WAIT
  • WARNINGS
  • WEEK
  • WEIGHT_STRING
  • WHEN
  • WHERE
  • WHILE
  • WINDOW
  • WITH
  • WITHOUT
  • WORK
  • WRAPPER
  • WRITE
  • X509
  • XA
  • XID
  • XML
  • XOR
  • YEAR
  • YEAR_MONTH
  • ZEROFILL
  • ZONE

There is a total of 733 SQL reserved words in MySQL. See the updated list in the documentation.

Reserved Words in PostgreSQL

This is the list of PostgreSQL reserved keywords:

  • ALL
  • ANALYSE
  • ANALYZE
  • AND
  • ANY
  • ARRAY
  • AS
  • ASC
  • ASYMMETRIC
  • AUTHORIZATION
  • BINARY
  • BOTH
  • CASE
  • CAST
  • CHECK
  • COLLATE
  • COLUMN
  • CONSTRAINT
  • CREATE
  • CROSS
  • CURRENT_CATALOG
  • CURRENT_DATE
  • CURRENT_ROLE
  • CURRENT_SCHEMA
  • CURRENT_TIME
  • CURRENT_TIMESTAMP
  • CURRENT_USER
  • DEFAULT
  • DEFERRABLE
  • DESC
  • DISTINCT
  • DO
  • ELSE
  • END
  • EXCEPT
  • FETCH
  • FALSE
  • FOR
  • FOREIGN
  • FROM
  • FULL
  • GRANT
  • GROUP
  • HAVING
  • ILIKE
  • IN
  • INITIALLY
  • INNER
  • INTERSECT
  • INTO
  • IS
  • ISNULL
  • JOIN
  • LATERAL
  • LEADING
  • LEFT
  • LIKE
  • LIMIT
  • LOCALTIME
  • LOCALTIMESTAMP
  • NATURAL
  • NOT
  • NOTNULL
  • NULL
  • OFFSET
  • ON
  • ONLY
  • OR
  • ORDER
  • OUTER
  • OVERLAPS
  • PLACING
  • PRIMARY
  • REFERENCES
  • RETURNING
  • RIGHT
  • SELECT
  • SESSION_USER
  • SIMILAR
  • SOME
  • SYMMETRIC
  • SYSTEM_USER
  • TABLE
  • TABLESAMPLE
  • THEN
  • TO
  • TRAILING
  • TRUE
  • UNION
  • UNIQUE
  • USING
  • VERBOSE
  • VARIADIC
  • WHEN
  • WHERE
  • WINDOW

There are 96 SQL reserved words in PostgreSQL. Take a look at the updated list in the official documentation.

Reserved Words in SQL Server

Unfortunately, the SQL Server documentation does not provide a list of reserved words. It only includes a list of reserved SQL keywords, which are terms and expressions with some meaning in SQL Server.

Below is the list of reserved keywords in SQL Server:

  • ADD
  • ALL
  • ALTER
  • AND
  • ANY
  • AS
  • ASC
  • AUTHORIZATION
  • BACKUP
  • BEGIN
  • BETWEEN
  • BREAK
  • BROWSE
  • BULK
  • BY
  • CASCADE
  • CASE
  • CHECK
  • CHECKPOINT
  • CLOSE
  • CLUSTERED
  • COALESCE
  • COLLATE
  • COLUMN
  • COMMIT
  • COMPUTE
  • CONSTRAINT
  • CONTAINS
  • CONTAINSTABLE
  • CONTINUE
  • CONVERT
  • CREATE
  • CROSS
  • CURRENT
  • CURRENT_DATE
  • CURRENT_TIME
  • CURRENT_TIMESTAMP
  • CURRENT_USER
  • CURSOR
  • DATABASE
  • DBCC
  • DEALLOCATE
  • DECLARE
  • DEFAULT
  • DELETE
  • DENY
  • DESC
  • DISK
  • DISTINCT
  • DISTRIBUTED
  • DOUBLE
  • DROP
  • DUMP
  • ELSE
  • END
  • ERRLVL
  • ESCAPE
  • EXCEPT
  • EXEC
  • EXECUTE
  • EXISTS
  • EXIT
  • EXTERNAL
  • FETCH
  • FILE
  • FILLFACTOR
  • FOR
  • FOREIGN
  • FREETEXT
  • FREETEXTTABLE
  • FROM
  • FULL
  • FUNCTION
  • GOTO
  • GRANT
  • GROUP
  • HAVING
  • HOLDLOCK
  • IDENTITY
  • IDENTITY_INSERT
  • IDENTITYCOL
  • IF
  • IN
  • INDEX
  • INNER
  • INSERT
  • INTERSECT
  • INTO
  • IS
  • JOIN
  • KEY
  • KILL
  • LEFT
  • LIKE
  • LINENO
  • LOAD
  • MERGE
  • NATIONAL
  • NOCHECK
  • NONCLUSTERED
  • NOT
  • NULL
  • NULLIF
  • OF
  • OFF
  • OFFSETS
  • ON
  • OPEN
  • OPENDATASOURCE
  • OPENQUERY
  • OPENROWSET
  • OPENXML
  • OPTION
  • OR
  • ORDER
  • OUTER
  • OVER
  • PERCENT
  • PIVOT
  • PLAN
  • PRECISION
  • PRIMARY
  • PRINT
  • PROC
  • PROCEDURE
  • PUBLIC
  • RAISERROR
  • READ
  • READTEXT
  • RECONFIGURE
  • REFERENCES
  • REPLICATION
  • RESTORE
  • RESTRICT
  • RETURN
  • REVERT
  • REVOKE
  • RIGHT
  • ROLLBACK
  • ROWCOUNT
  • ROWGUIDCOL
  • RULE
  • SAVE
  • SCHEMA
  • SECURITYAUDIT
  • SELECT
  • SEMANTICKEYPHRASETABLE
  • SEMANTICSIMILARITYDETAILSTABLE
  • SEMANTICSIMILARITYTABLE
  • SESSION_USER
  • SET
  • SETUSER
  • SHUTDOWN
  • SOME
  • STATISTICS
  • SYSTEM_USER
  • TABLE
  • TABLESAMPLE
  • TEXTSIZE
  • THEN
  • TO
  • TOP
  • TRAN
  • TRANSACTION
  • TRIGGER
  • TRUNCATE
  • TRY_CONVERT
  • TSEQUAL
  • UNION
  • UNIQUE
  • UNPIVOT
  • UPDATE
  • UPDATETEXT
  • USE
  • USER
  • VALUES
  • VARYING
  • VIEW
  • WAITFOR
  • WHEN
  • WHERE
  • WHILE
  • WITH
  • WITHIN GROUP
  • WRITETEXT

There is a total of 187 reserved SQL keywords in SQL Server. Check out the documentation for more information.

Reserved Words in Oracle

This is the list of SQL reserved words in Oracle:

  • ACCESS
  • ADD
  • ALL
  • ALTER
  • AND
  • ANY
  • AS
  • ASC
  • AUDIT
  • BETWEEN
  • BY
  • CHAR
  • CHECK
  • CLUSTER
  • COLUMN
  • COMMENT
  • COMPRESS
  • CONNECT
  • CREATE
  • CURRENT
  • DATE
  • DECIMAL
  • DEFAULT
  • DELETE
  • DESC
  • DISTINCT
  • DROP
  • ELSE
  • EXCLUSIVE
  • EXISTS
  • FILE
  • FLOAT
  • FOR
  • FROM
  • GRANT
  • GROUP
  • HAVING
  • IDENTIFIED
  • IMMEDIATE
  • IN
  • INCREMENT
  • INDEX
  • INITIAL
  • INSERT
  • INTEGER
  • INTERSECT
  • INTO
  • IS
  • LEVEL
  • LIKE
  • LOCK
  • LONG
  • MAXEXTENTS
  • MINUS
  • MLSLABEL
  • MODE
  • MODIFY
  • NOAUDIT
  • NOCOMPRESS
  • NOT
  • NOWAIT
  • NULL
  • NUMBER
  • OF
  • OFFLINE
  • ON
  • ONLINE
  • OPTION
  • OR
  • ORDER
  • PCTFREE
  • PRIOR
  • PUBLIC
  • RAW
  • RENAME
  • RESOURCE
  • REVOKE
  • ROW
  • ROWID
  • ROWNUM
  • ROWS
  • SELECT
  • SESSION
  • SET
  • SHARE
  • SIZE
  • SMALLINT
  • START
  • SUCCESSFUL
  • SYNONYM
  • SYSDATE
  • TABLE
  • THEN
  • TO
  • TRIGGER
  • UID
  • UNION
  • UNIQUE
  • UPDATE
  • USER
  • VALIDATE
  • VALUES
  • VARCHAR
  • VARCHAR2
  • VIEW
  • WHENEVER
  • WHERE
  • WITH

There are 109 reserved words in SQL within Oracle. Explore the documentation for the updated list.

Dealing With SQL Reserved Words

Reserved SQL words are predefined words that are reserved for specific purposes within the language. Usually, these words have a particular meaning in SQL statements and queries.

In particular, most SQL reserved words fall into one of these three categories:

  • Words for SQL statements and clauses: For constructing SQL queries (e.g., SELECT, INSERT, UPDATE, DELETE, FROM, WHERE, GROUP BY, ORDER BY, JOIN, ON, AS, DISTINCT, [UNION], ALL, HAVING, LIMIT, etc.)
  • Data types and constraints: For defining data types (e.g., INTEGER, VARCHAR, DATE, BOOLEAN, etc.) and constraints (e.g., PRIMARY, KEY, UNIQUE, etc.). Discover more in our guides about PostgreSQL data types and PostgreSQL data integrity.
  • Operators: Used for comparison (e.g., LIKE, BETWEEN, etc.) and logical operations (e.g., AND, OR, NOT).
  • Miscellaneous: Words like CASE, WHEN, THEN, ELSE, END, CAST, EXCEPT, WINDOW, etc.

In total, the SQL:2023 ANSI/ISO standard defines over 350 reserved words. Remembering them all is almost impossible, but using any of them in your query without the right precautions will result in an error. That can be a significant challenge!

Fortunately, dealing with reserved words in SQL becomes much easier with a tool like DbVisualizer. This comprehensive database client features a full-featured SQL editor with autocomplete capabilities:

SQL autocomplete capabilities in DbVisualizer
SQL autocomplete capabilities in DbVisualizer

Autocomplete helps you type SQL statements faster and more accurately by suggesting keywords, table names, column names, and functions as you type. This feature significantly aids in SQL development. On top of that, DbVisualizer offers syntax error highlighting, making it easier to detect errors in your SQL queries:

Visual syntax error reporting in DbVisualizer
Visual syntax error reporting in DbVisualizer

Conclusion

In this guide, you explored the list of reserved SQL words in MySQL, PostgreSQL, SQL Server, and Oracle. You also learned how to use them in SQL queries. With hundreds of reserved words in SQL, remembering them all can be challenging. This is where a powerful database client like DbVisualizer comes in!

With its advanced autocomplete capabilities, DbVisualizer simplifies writing queries across more than 50 databases. Additionally, this powerful tool offers advanced query optimization, query formatting, and the ability to generate ERD-type schemas with a single click. Try DbVisualizer for free!

FAQ

What happens when trying to use a reserved word in SQL?

Using reserved words in SQL without proper handling, such as by wrapping them with single or double quotes or backticks like ”`” can lead to syntax errors. In some cases, inserting these words in specific parts of a query can even lead to unexpected behavior.

How many SQL reserved words are there?

The SQL:2023 ISO standard defines more than 350 reserved words, but each specific dialect has its own set of reserved SQL words. Follow the links below for more details:

What is the difference between a reserved keyword and a non-reserved keyword in SQL?

SQL distinguishes between reserved and non-reserved keywords. Reserved keywords are the only real keywords, and they are never allowed as identifiers. Non-reserved keywords only have a special meaning in particular contexts and can be used as identifiers in other contexts. The concept of non-reserved keywords essentially only exists to declare that a specific word has some predefined meaning in some contexts.

How to use reserved SQL words in a query?

To use reserved SQL words as identifiers in a query, you typically need to enclose them in double quotes, single quotes, or backticks, based on the SQL dialect you are using.

Where can I find a list of list of SQL reserved words?

You can find a list of all reserved SQL words in all major database systems in this article and on the Wikipedia "List of SQL reserved words" page.

Dbvis download link img
About the author
Antonello Zanini

Antonello is a software engineer, and often refers to himself as a technology bishop. His mission is to spread knowledge through writing.

The Table Icon
Sign up to receive The Table's roundup
More from the table
Title Author Tags Length Published
title

MySQL Nullable Columns: Everything You Need to Know

author Antonello Zanini tags MySQL 6 min 2024-12-03
title

A Complete Guide to the MySQL GROUP_CONCAT Function

author Antonello Zanini tags Data aggregation MySQL 8 min 2024-12-02
title

How and Why to Add an Index in SQL

author Lukas Vileikis tags MySQL POSTGRESQL Search SQL SQL SERVER 8 min 2024-11-28
title

MySQL 9.0 and the New EXPLAIN Features

author Lukas Vileikis tags MySQL SQL 9 min 2024-11-27
title

Massive SQL DELETE Operations and Database Purging Explained

author Lukas Vileikis tags DELETE SQL 4 min 2024-11-26
title

MySQL CAST: A Guide to the Data Conversion Function

author Antonello Zanini tags MySQL 3 min 2024-11-25
title

Postgres Create Array of Numbers: Complete Guide

author Lukas Vileikis tags POSTGRESQL SQL 7 min 2024-11-21
title

A Beginner’s Guide to SQL & Relational Database Management Systems

author Leslie S. Gyamfi tags BEGINNER SQL 5 min 2024-11-19
title

SQL Variable: What It Is and How To Use It

author Antonello Zanini tags MySQL ORACLE POSTGRESQL SQL SQL SERVER 8 min 2024-11-18
title

SQL Server CTE: Everything You Need to Know

author Antonello Zanini tags SQL SERVER 9 min 2024-11-14

The content provided on dbvis.com/thetable, including but not limited to code and examples, is intended for educational and informational purposes only. We do not make any warranties or representations of any kind. Read more here.

Cookie policy

We use cookies to ensure that we give you the best experience on our website. However you can change your cookie settings at any time in your browser settings. Please find our cookie policy here ↗