![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
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
Do underscores in a MySQL table name cause issues?
No, you won’t get any issues with underscores in a MySQL table name. You will get the issues with a dash in a MySQL table name.
Here is the demo that does not have any issue with underscore with table names −
_StudentTrackerDemo
Let us see the same while creating a table. The query to create a table is as follows −
mysql> create table _StudentTrackerDemo -> ( -> StudentId int, -> StudentFirstName varchar(100) -> ); Query OK, 0 rows affected (0.75 sec)
The underscore is valid for table names but dash is not valid in some MySQL versions. Here is the table name with dash. The same gives an error −
mysql> create table Student-table -> ( -> Id int, -> Name varchar(100) -> ); 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 '-table (Id int, Name varchar(100) )' at line 1
Advertisements