- 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
Underscore as a table name in MySQL is possible?
Yes, we can add underscore as a table name using backticks around the table name. Following is the syntax −
INSERT INTO `yourTableName` values(yourValue1,.......N);
Let us first create a table −
mysql> create table `DemoTable_1` ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Location varchar(100) ); Query OK, 0 rows affected (1.17 sec)
Insert some records in the table using insert command −
mysql> insert into `DemoTable_1`(Location) values('C:/myFolder/JavaFiles'); Query OK, 1 row affected (0.20 sec) mysql> insert into `DemoTable_1`(Location) values('E:/AllJarOfJava'); Query OK, 1 row affected (0.17 sec) mysql> insert into `DemoTable_1`(Location) values('C:/ProgramFiles'); Query OK, 1 row affected (0.17 sec)
Display all records from the table using select statement −
mysql> select *from `DemoTable_1`;
This will produce the following output −
+----+-----------------------+ | Id | Location | +----+-----------------------+ | 1 | C:/myFolder/JavaFiles | | 2 | E:/AllJarOfJava | | 3 | C:/ProgramFiles | +----+-----------------------+ 3 rows in set (0.00 sec)
- Related Articles
- Can we give underscore in a MySQL table name?
- Is it possible to have View and table with the same name in MySQL?
- Select the table name as a column in a UNION select query with MySQL?
- Will “create table table” work in MySQL since we cannot use reserved words as table name?
- MySQL syntax error (in SELECT query) while using ‘group’ as table name
- How to match underscore in a MySQL String?
- What is the maximum length of a table name in MySQL?
- Do underscores in a MySQL table name cause issues?
- MySQL ORDER BY strings with underscore?
- Extract gender values as a string when it is stored in the table as a Boolean in MySQL
- How is it possible to store date such as February 30 in a MySQL date column?
- Update a column in MySQL and remove the trailing underscore values
- How to resolve the error that occurs while using a reserved word as a table or column name in MySQL?
- Can we create a table with a space in name in MySQL?
- MySQL query to display columns name first name, last name as full name in a single column?

Advertisements