- 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
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)
Advertisements