MySQL表名称中的下划线会引起问题吗?

不,MySQL表名中的下划线不会有任何问题。您将在MySQL表名称中出现破折号。

这是演示,使用表名的下划线没有任何问题-

_StudentTrackerDemo

让我们在创建表时看到相同的内容。创建表的查询如下-

mysql> create table _StudentTrackerDemo
   -> (
   -> StudentId int,
   -> StudentFirstName varchar(100)
   -> );

下划线对表名有效,但连字符在某些MySQL版本中无效。这是带破折号的表名。同样会产生错误-

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