mysql 创建表时出现和引号相关的问题

CREATE TABLE 'product_category' (
    'category_id' INT NOT NULL auto_increment,
    'category_name' VARCHAR (64) NOT NULL COMMENT '类目名称,' || 'category_type' INT NOT NULL COMMENT '类目编号',
    'create_time' TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    'update_time' TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY ('category_id'),
    UNIQUE KEY 'uqe_category_type' ('category_type')
) COMMENT '类目表' ;

上面的建表语句在刚开始的时候我并没有觉得有神魔问题,你们觉得呢?

但是 运行时出现了

Err] 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 ''product_category' (
    'category_id' INT NOT NULL auto_increment,
    'category_na' at line 1


意不意外,惊不惊喜!

找了好长时间,原来我们在建表的时候,表名和属性名不是用的英文的单引号,而是英文的反单引号,在英文模式下按~,就解决了!

猜你喜欢

转载自blog.csdn.net/qq_37992974/article/details/87992685