# Reserved Words

The following is a list of all reserved words in MariaDB.

Reserved words cannot be used as [Identifiers](https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/identifier-names), unless they are quoted.

The definitive list of reserved words for each version can be found by examining the `sql/lex.h` and `sql/sql_yacc.yy` files.

## Reserved Words

| Keyword                           |
| --------------------------------- |
| ACCESSIBLE                        |
| ADD                               |
| ALL                               |
| ALTER                             |
| ANALYZE                           |
| AND                               |
| AS                                |
| ASC                               |
| ASENSITIVE                        |
| BEFORE                            |
| BETWEEN                           |
| BIGINT                            |
| BINARY                            |
| BLOB                              |
| BOTH                              |
| BY                                |
| CALL                              |
| CASCADE                           |
| CASE                              |
| CHANGE                            |
| CHAR                              |
| CHARACTER                         |
| CHECK                             |
| COLLATE                           |
| COLUMN                            |
| CONDITION                         |
| CONSTRAINT                        |
| CONTINUE                          |
| CONVERT                           |
| CREATE                            |
| CROSS                             |
| CURRENT\_DATE                     |
| CURRENT\_ROLE                     |
| CURRENT\_TIME                     |
| CURRENT\_TIMESTAMP                |
| CURRENT\_USER                     |
| CURSOR                            |
| DATABASE                          |
| DATABASES                         |
| DAY\_HOUR                         |
| DAY\_MICROSECOND                  |
| DAY\_MINUTE                       |
| DAY\_SECOND                       |
| DEC                               |
| DECIMAL                           |
| DECLARE                           |
| DEFAULT                           |
| DELAYED                           |
| DELETE                            |
| DELETE\_DOMAIN\_ID                |
| DESC                              |
| DESCRIBE                          |
| DETERMINISTIC                     |
| DISTINCT                          |
| DISTINCTROW                       |
| DIV                               |
| DO\_DOMAIN\_IDS                   |
| DOUBLE                            |
| DROP                              |
| DUAL                              |
| EACH                              |
| ELSE                              |
| ELSEIF                            |
| ENCLOSED                          |
| ESCAPED                           |
| EXCEPT                            |
| EXISTS                            |
| EXIT                              |
| EXPLAIN                           |
| FALSE                             |
| FETCH                             |
| FLOAT                             |
| FLOAT4                            |
| FLOAT8                            |
| FOR                               |
| FORCE                             |
| FOREIGN                           |
| FROM                              |
| FULLTEXT                          |
| GENERAL                           |
| GRANT                             |
| GROUP                             |
| HAVING                            |
| HIGH\_PRIORITY                    |
| HOUR\_MICROSECOND                 |
| HOUR\_MINUTE                      |
| HOUR\_SECOND                      |
| IF                                |
| IGNORE                            |
| IGNORE\_DOMAIN\_IDS               |
| IGNORE\_SERVER\_IDS               |
| IN                                |
| INDEX                             |
| INFILE                            |
| INNER                             |
| INOUT                             |
| INSENSITIVE                       |
| INSERT                            |
| INT                               |
| INT1                              |
| INT2                              |
| INT3                              |
| INT4                              |
| INT8                              |
| INTEGER                           |
| INTERSECT                         |
| INTERVAL                          |
| INTO                              |
| IS                                |
| ITERATE                           |
| JOIN                              |
| KEY                               |
| KEYS                              |
| KILL                              |
| LEADING                           |
| LEAVE                             |
| LEFT                              |
| LIKE                              |
| LIMIT                             |
| LINEAR                            |
| LINES                             |
| LOAD                              |
| LOCALTIME                         |
| LOCALTIMESTAMP                    |
| LOCK                              |
| LONG                              |
| LONGBLOB                          |
| LONGTEXT                          |
| LOOP                              |
| LOW\_PRIORITY                     |
| MASTER\_HEARTBEAT\_PERIOD         |
| MASTER\_SSL\_VERIFY\_SERVER\_CERT |
| MATCH                             |
| MAXVALUE                          |
| MEDIUMBLOB                        |
| MEDIUMINT                         |
| MEDIUMTEXT                        |
| MIDDLEINT                         |
| MINUTE\_MICROSECOND               |
| MINUTE\_SECOND                    |
| MOD                               |
| MODIFIES                          |
| NATURAL                           |
| NOT                               |
| NO\_WRITE\_TO\_BINLOG             |
| NULL                              |
| NUMERIC                           |
| OFFSET (> 10.6)                   |
| ON                                |
| OPTIMIZE                          |
| OPTION                            |
| OPTIONALLY                        |
| OR                                |
| ORDER                             |
| OUT                               |
| OUTER                             |
| OUTFILE                           |
| OVER                              |
| PAGE\_CHECKSUM                    |
| PARSE\_VCOL\_EXPR                 |
| PARTITION                         |
| PRECISION                         |
| PRIMARY                           |
| PROCEDURE                         |
| PURGE                             |
| RANGE                             |
| READ                              |
| READS                             |
| READ\_WRITE                       |
| REAL                              |
| RECURSIVE                         |
| REF\_SYSTEM\_ID                   |
| REFERENCES                        |
| REGEXP                            |
| RELEASE                           |
| RENAME                            |
| REPEAT                            |
| REPLACE                           |
| REQUIRE                           |
| RESIGNAL                          |
| RESTRICT                          |
| RETURN                            |
| RETURNING                         |
| REVOKE                            |
| RIGHT                             |
| RLIKE                             |
| ROW\_NUMBER (> 10.7)              |
| ROWS                              |
| SCHEMA                            |
| SCHEMAS                           |
| SECOND\_MICROSECOND               |
| SELECT                            |
| SENSITIVE                         |
| SEPARATOR                         |
| SET                               |
| SHOW                              |
| SIGNAL                            |
| SLOW                              |
| SMALLINT                          |
| SPATIAL                           |
| SPECIFIC                          |
| SQL                               |
| SQLEXCEPTION                      |
| SQLSTATE                          |
| SQLWARNING                        |
| SQL\_BIG\_RESULT                  |
| SQL\_CALC\_FOUND\_ROWS            |
| SQL\_SMALL\_RESULT                |
| SSL                               |
| STARTING                          |
| STATS\_AUTO\_RECALC               |
| STATS\_PERSISTENT                 |
| STATS\_SAMPLE\_PAGES              |
| STRAIGHT\_JOIN                    |
| TABLE                             |
| TERMINATED                        |
| THEN                              |
| TINYBLOB                          |
| TINYINT                           |
| TINYTEXT                          |
| TO                                |
| TRAILING                          |
| TRIGGER                           |
| TRUE                              |
| UNDO                              |
| UNION                             |
| UNIQUE                            |
| UNLOCK                            |
| UNSIGNED                          |
| UPDATE                            |
| USAGE                             |
| USE                               |
| USING                             |
| UTC\_DATE                         |
| UTC\_TIME                         |
| UTC\_TIMESTAMP                    |
| VALUES                            |
| VARBINARY                         |
| VARCHAR                           |
| VARCHARACTER                      |
| VARYING                           |
| VECTOR (> 11.6)                   |
| WHEN                              |
| WHERE                             |
| WHILE                             |
| WINDOW                            |
| WITH                              |
| WRITE                             |
| XOR                               |
| YEAR\_MONTH                       |
| ZEROFILL                          |

## Exceptions

Some keywords are exceptions for historical reasons, and are permitted as unquoted identifiers. These include:

| Keyword                                                                                              |
| ---------------------------------------------------------------------------------------------------- |
| ACTION                                                                                               |
| [BIT](https://mariadb.com/docs/server/reference/data-types/numeric-data-types/bit)                   |
| [DATE](https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/date)           |
| [ENUM](https://mariadb.com/docs/server/reference/data-types/string-data-types/enum)                  |
| NO                                                                                                   |
| [TEXT](https://mariadb.com/docs/server/reference/data-types/string-data-types/text)                  |
| [TIME](https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/time)           |
| [TIMESTAMP](https://mariadb.com/docs/server/reference/data-types/date-and-time-data-types/timestamp) |

## Oracle Mode

In [Oracle mode](https://app.gitbook.com/s/aEnK0ZXmUbJzqQrTjFyb/community-server/about/compatibility-and-differences/sql_modeoracle), there are a number of extra reserved words:

| Keyword          |
| ---------------- |
| BODY             |
| ELSIF            |
| GOTO             |
| HISTORY          |
| MINUS (> 10.6.0) |
| OTHERS           |
| PACKAGE          |
| PERIOD           |
| RAISE            |
| ROWNUM           |
| ROWTYPE          |
| SYSDATE          |
| SYSTEM           |
| SYSTEM\_TIME     |
| VERSIONING       |
| WITHOUT          |

### Contextual Keywords and Parser Limitations

The lists above indicate words that are always reserved and must be quoted. Some keywords, though, are reserved for specific contexts. In most SQL statements, they operate normally, but in some cases, they activate unique parser rules.

The Oracle mode term `SYSTEM` is a prime example. Although it is not a fully reserved word, the parser expects the VERSIONING keyword to follow (as part of the `SYSTEM VERSIONING` clause for [system-versioned tables](https://mariadb.com/docs/server/reference/sql-structure/temporal-tables/system-versioned-tables)), which results in a syntax error in an `ALTER TABLE ... ADD` command.

**Example of unexpected behavior**

The following examples show how the keyword SYSTEM behaves as an identifier:

```sql
CREATE TABLE t1 (system INT);
```

This statement works because SYSTEM is a valid column name in this situation.

Invalid usage

```sql
ALTER TABLE t1 ADD system VARCHAR(64);
```

This statement fails due to a syntax error.

```
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VARCHAR(64)' at line 1
```

To avoid any conflict, always quote such keywords when using them as identifiers in statements.

```
ALTER TABLE t1 ADD `system` VARCHAR(64);
```

It is recommended that all identifiers listed as keywords (including those indicated as non-reserved or version-specific) be quoted for maximum compatibility and to prevent unexpected parser errors, especially in `ALTER` statements.

## Function Names

If the `IGNORE_SPACE` [SQL\_MODE](https://mariadb.com/docs/server/server-management/variables-and-modes/sql_mode) flag is set, function names become reserved words.

## See Also

* [Information Schema KEYWORDS Table](https://mariadb.com/docs/server/reference/system-tables/information-schema/information-schema-tables/information-schema-keywords-table)

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/sql-structure/sql-language-structure/reserved-words.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
