gpt4 book ai didi

mysql - 在 MySQL 中创建 SQL 表时遇到错误

转载 作者:行者123 更新时间:2023-11-29 05:01:23 24 4
gpt4 key购买 nike

MySQL 正在返回错误,但未指定错误是什么。它把这条语句扔回去

ERROR: syntax error at or near "(" LINE 2: "order_id" INT(10) NOT NULL, ^

我创建表格的代码是:

CREATE TABLE dispatch (
"order_id" INT(10) NOT NULL,
"order_created_at"" DATETIME ,
"order_number"" VARCHAR(30),
"shipment_fc"" TINYTEXT,
"shipment_priority"" TINYTEXT,
"shipment_id"" INT(10),
"shipment_status"" TINYTEXT,
"shipment_number"" VARCHAR(30),
"orderline_id"" INT(10),
"processed_quantity"" INT(10),
"orderline_client_name"" VARCHAR(30),
"updated_at"" DATETIME,
"waybill_created_at"" DATETIME,
"child_waybill"" INT,
"master_waybill"" INT,
"shipped_at"" DATETIME,
"cpt"" DATETIME,
"diff"" FLOAT,
"tat"" TINYTEXT,
PRIMARY KEY ("order_id")
)

我已经基于 if MySQL 在创建表之前提供的示例代码:

CREATE TABLE schema.table_name (
"field_1" INT(10) NOT NULL,
"field_2"" VARCHAR(20),
"field_3"" DATETIME,
"field_4"" TEXT,
"field_5"" BLOB,
PRIMARY KEY ("field_1")
)
[WITH OIDS|WITHOUT OIDS]

如有任何帮助,我们将不胜感激。

最佳答案

您需要删除双引号,然后它才能工作。

CREATE TABLE dispatch (
order_id INT(10) NOT NULL,
order_created_at DATETIME ,
order_number VARCHAR(30),
shipment_fc TINYTEXT,
shipment_priority TINYTEXT,
shipment_id INT(10),
shipment_status TINYTEXT,
shipment_number VARCHAR(30),
orderline_id INT(10),
processed_quantity INT(10),
orderline_client_name VARCHAR(30),
updated_at DATETIME,
waybill_created_at DATETIME,
child_waybill INT,
master_waybill INT,
shipped_at DATETIME,
cpt DATETIME,
diff FLOAT,
tat TINYTEXT,
PRIMARY KEY (order_id)
);
/

这是 DEMO

关于mysql - 在 MySQL 中创建 SQL 表时遇到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58597180/

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