- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Is name a reserved word in MySQL?
No, name is not a reserved word in MySQL, you can use without backtick symbol. If you are working on a reserved word then use backtick symbol. Let us first create a table −
mysql> create table name ( name varchar(10) ); Query OK, 0 rows affected (0.78 sec)
Now you can insert some records in the table using insert command −
mysql> insert into name values('John'); Query OK, 1 row affected (0.13 sec) mysql> insert into name values('Carol'); Query OK, 1 row affected (0.14 sec)
Display all records from the table using select statement −
mysql> select *from name;
Output
+-------+ | name | +-------+ | John | | Carol | +-------+ 2 rows in set (0.00 sec)
If you have a reserved word then you need to use backtick symbol. Let us now create a table with table name as reserved word “select” −
mysql> create table `select` ( `select` int ); Query OK, 0 rows affected (0.70 sec)
Above we have used a backtick symbol, since we are considering the table name as reserved word. Now you can insert some records in the table using insert command −
mysql> insert into `select` values(1); Query OK, 1 row affected (0.16 sec)
Display all records from the table using select statement −
mysql> select `select` from `select`;
Output
+--------+ | select | +--------+ | 1 | +--------+ 1 row in set (0.00 sec)
Advertisements