
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Use Reserved Keyword 'KEY' While Creating MySQL Table
To use the reserved keyword ‘Key’, use the concept of the backtick symbol. Here, for our example, I am using the column name key which needs a backtick symbol around the column name.
Let us first create a table −
mysql> create table DemoTable ( `Key` int ); Query OK, 0 rows affected (0.67 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values(100); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values(101); Query OK, 1 row affected (0.55 sec) mysql> insert into DemoTable values(110); Query OK, 1 row affected (0.28 sec) mysql> insert into DemoTable values(120); Query OK, 1 row affected (0.09 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+------+ | Key | +------+ | 100 | | 101 | | 110 | | 120 | +------+ 4 rows in set (0.00 sec)
Advertisements