不,mysql 表名中的下划线不会出现任何问题。 mysql 表名中的破折号会出现问题。
这是一个演示,表名中的下划线没有任何问题 -
_studenttrackerdemo
让我们在创建表时看到同样的情况。创建表的查询如下 -
mysql> create table _studenttrackerdemo -> ( -> studentid int, -> studentfirstname varchar(100) -> );query ok, 0 rows affected (0.75 sec)
下划线对于表名有效,但破折号在某些 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 thatcorresponds to your mysql server version for the right syntax to use near '-table(id int, name varchar(100) )' at line 1
以上就是mysql 表名中的下划线会导致问题吗?的详细内容。