gpt4 book ai didi

mysql - 当我尝试定义 MySQL 表时,请帮助解决语法错误

转载 作者:行者123 更新时间:2023-11-29 08:51:39 24 4
gpt4 key购买 nike

错误是这样的;

#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 ''order'(
orderID VARCHAR(6) NOT NULL DEFAULT 0,
orderDate DATE NOT NULL DEFAUL' at line 1

我的 DDL 是这样的:

CREATE TABLE 'order'(
orderID VARCHAR(6) NOT NULL DEFAULT 0,
orderDate DATE NOT NULL DEFAULT 1,
claimCondition VARCHAR(30) NOT NULL DEFAULT ''
);

最佳答案

名称​​order是一个保留字,因此您必须为该表命名其他名称。此外,值 1 不是日期类型的有效默认值。

这有效:

CREATE TABLE order1 (
orderID VARCHAR(6) NOT NULL DEFAULT 0,
orderDate DATE NOT NULL,
claimCondition VARCHAR(30) NOT NULL DEFAULT ''
);

关于mysql - 当我尝试定义 MySQL 表时,请帮助解决语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11026728/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com