在 mysql 表名中使用 (-) 破折号

2023-12-11

我想备份数据库时出现错误

A Database Error Occurred

Error Number: 1064

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 '-01-000001' at line 1

SELECT * FROM temp_01-01-000001

Filename: F:\xampp\htdocs\erp_zaara\system\database\DB_driver.php

Line Number: 330

有没有办法用表名(temp_01-01-000001)解决这个问题。


您必须添加引号,因为您的表名称包含数字。我认为以下查询会起作用。

SELECT * FROM `temp_01-01-000001`
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 mysql 表名中使用 (-) 破折号 的相关文章