在mysql中创建纯数字数据库是不合标准的,默认会提示语法错误,但通过mysql转义符 ` 还是可以创建。
CREATE DATABASE 222;
报错:
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 '222' at line 1
# 加上转义符
CREATE DATABASE `222`;
成功。
# 查询语句
SELECT * FROM 222.aaa WHERE id = 1;
报错:
错误码: 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 '222.aaa WHERE id = 1' at line 1
# 加上转义符查询
SELECT * FROM `222`.aaa WHERE id = 1;
可以查询
# 删除加转义符删除
DROP DATABASE `222`;
原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/4870.html