- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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?nname?
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)
- Related Articles
- How can create a table having the name like a^b along with same column name? name?
- How can I query for all the tables having a particular column name?
- How can we match the values having backslashes, like ‘ab’, from MySQL column?
- Can we create a table with a space in name in MySQL?
- Can we use “When” as column name in CREATE TABLE statement?
- How to name a data frame column with a vector value that has the same name in R?
- Create a dynamic table name from current year in MySQL like 2019
- Can a number be used to name a MySQL table column?
- How can I change the name of an existing column from a MySQL table?
- Change the column name from a MySQL table with Student record?
- How to create a table TAB2 having same attributes & columns as for table TAB1
- Can we create a database with a numeric name with MySQL?
- How to create a boxplot of single column in R data frame with column name?
- Select the table name as a column in a UNION select query with MySQL?
- How can we change the name of a MySQL table?
- How to create a table with date column?

Advertisements