MySQL reserved keywords
In MySQL, there are several reserved keywords that have special meanings in SQL and cannot be used as identifiers such as table names, column names, or aliases without quoting. Here are some of the reserved keywords in MySQL:
- ADD
- ALL
- ALTER
- ANALYZE
- AND
- AS
- ASC
- AUTO_INCREMENT
- BETWEEN
- BINARY
- BOTH
- BY
- CASE
- CASCADE
- CHAR
- CHECK
- COLLATE
- COLUMN
- CONSTRAINT
- CREATE
- CURRENT_DATE
- CURRENT_TIME
- CURRENT_TIMESTAMP
- DATABASE
- DEFAULT
- DELETE
- DESC
- DISTINCT
- DROP
- ELSE
- ENCLOSED
- ENUM
- ESCAPED
- EXISTS
- EXPLAIN
- FALSE
- FETCH
- FLOAT
- FOR
- FOREIGN
- FROM
- FULLTEXT
- GROUP
- HAVING
- IF
- IGNORE
- IN
- INDEX
- INNER
- INSERT
- INTO
- IS
- JOIN
- KEY
- LEFT
- LIKE
- LIMIT
- LOCK
- MATCH
- NATURAL
- NOT
- NULL
- ON
- OR
- ORDER
- OUTER
- PRIMARY
- REFERENCES
- RIGHT
- SELECT
- SET
- SHOW
- TABLE
- THEN
- TO
- TRUNCATE
- TRUE
- UNION
- UNIQUE
- UPDATE
- VALUES
- VARCHAR
- WHEN
- WHERE
- WITH
It’s important to note that although these words are reserved, you can still use them as identifiers if you quote them using backticks (`). However, it’s generally a good practice to avoid using reserved keywords as identifiers to prevent potential confusion and errors.