
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How can we use the MySQL reserved words as an identifier?
We must have to use quotes with reserved words to use them as an identifier. The quotes can be single or double depends upon ANSI_QUOTES SQL mode.
If this mode is disabled then the identifier quote character is the backtick (“`”). Consider the following example in which we created a table named ‘select’ −
mysql> create table `select`(id int); Query OK, 0 rows affected (0.19 sec)
If this mode is enabled then we can use backtick (“`”) and double quotes (“”) both as identifier quote character. Consider the following example in which we created a table named ‘trigger’ −
mysql> Create table "trigger" (id int); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"trigger" (id int)' at line 1 mysql> Set sql_mode = 'ANSI_Quotes'; Query OK, 0 rows affected (0.03 sec) mysql> Create table "trigger" (id int); Query OK, 0 rows affected (0.17 sec) mysql> Create table `DESCRIBE`(id int); Query OK, 0 rows affected (0.11 sec)
The queries above show that we can use both backtick (“`”) and double quotes (“”) both as identifier quote character after enabling ‘ANSI_QUOTES’ mode.
- Related Articles
- Can we use reserved word ‘index’ as MySQL column name?
- Will “create table table” work in MySQL since we cannot use reserved words as table name?
- Can we use semicolon as a MySQL DEMILITER?
- How can we use a JavaScript function as an object?
- In MySQL, how can we represent the time value as an integer?
- How can we use MySQL SUM() function?
- Can we use MySQL keyword as alias name for a column?
- How can we use prepared statements in MySQL?
- How can we use nested transactions in MySQL?
- Can we use “year” as a column came in a MySQL Table?
- What are Reserved Words in Python?
- What are Reserved Words in JavaScript?
- As an individual, what methods can we use to save water?
- While creating a MySQL table use the reserved keyword ‘Key’
- How can we update any value in MySQL view as we can update the values in MySQL table?

Advertisements