Home >Database >Mysql Tutorial >Can underscores in MySQL table names cause problems?
No, there are no problems with underscores in MySQL table names. Dashes in MySQL table names can cause problems.
This is a demo, there is no problem with underscores in table names -
_StudentTrackerDemo
Let us see the same while creating the table. The query to create the table is as follows -
mysql> create table _StudentTrackerDemo -> ( -> StudentId int, -> StudentFirstName varchar(100) -> ); Query OK, 0 rows affected (0.75 sec)
Underscores are valid for table names, but dashes are not valid in some MySQL versions. This is the table name with a dash. The same error occurs -
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
The above is the detailed content of Can underscores in MySQL table names cause problems?. For more information, please follow other related articles on the PHP Chinese website!