- 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
How can create a table having the name like a^b along with same column name?
name?
For creating a table with such kinds of names we must have to use quote character. 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 `a^b`(`a^b` int); Query OK, 0 rows affected (0.19 sec) mysql> Create table "a^g"("a^g" 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 '"a^g" ("a^g" int)' at line 1
If this mode is enabled then we can use backtick (“`”) and double quotes (“”) both as a quote character. Consider the following example in which we created the table like the above name with the help of both quote characters after enabling this mode −
mysql> Set sql_mode = 'ANSI_Quotes'; Query OK, 0 rows affected (0.03 sec) mysql> Create table "a^d"("a^d" int); Query OK, 0 rows affected (0.21 sec) mysql> Create table `a^e`(`a^e` int); Query OK, 0 rows affected (0.14 sec)
Advertisements