
- 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
Error occurs when table name “references” is set while creating a table
You cannot give table name references because it is a reserved keyword. Wrap it using backticks, for example, `references`.
Let us first create a table −
mysql> create table `references`(Subject text); Query OK, 0 rows affected (0.44 sec)
Insert some records in the table using insert command −
mysql> insert into `references` values('Introduction To MySQL'); Query OK, 1 row affected (0.28 sec) mysql> insert into `references` values('Introduction To MongoDB'); Query OK, 1 row affected (0.15 sec) mysql> insert into `references` values('Introduction To Spring and Hibernate'); Query OK, 1 row affected (0.13 sec) mysql> insert into `references` values('Introduction To Java'); Query OK, 1 row affected (0.18 sec)
Display all records from the table using select statement −
mysql> select *from `references`;
This will produce the following output -
+--------------------------------------+ | Subject | +--------------------------------------+ | Introduction To MySQL | | Introduction To MongoDB | | Introduction To Spring and Hibernate | | Introduction To Java | +--------------------------------------+ 4 rows in set (0.00 sec)
- Related Articles
- Fix Error in MySQL syntax while creating a table column with name “index”?
- Set AUTO_INCREMENT in a table while creating it in MySQL?
- Set DEFAULT values for columns while creating a table in MySQL
- How to resolve the error that occurs while using a reserved word as a table or column name in MySQL?
- Set options while creating a MySQL table. Display the same options as well
- Can we use {} while creating a MySQL table?
- Set a custom value for AUTO_INCREMENT while creating a table and use ZEROFILL. What will happen now when nothing is inserted while using INSERT statement?
- MySQL syntax error (in SELECT query) while using ‘group’ as table name
- While creating a MySQL table use the reserved keyword ‘Key’
- MySQL throws an error when the table name “match” is not surrounded by single quotes?
- Display an error while inserting duplicate records in a MySQL table
- Getting error- is not an internal table “OCCURS n” specification is missing in SAP method
- What is the MySQL syntax error in this query – Creating a table with reserved keyword?
- What is MySQL GENERATED COLUMN and how to use it while creating a table?
- No error while inserting record in child table with no match in master table in SAP

Advertisements