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

时间:2019-10-28 19:22:45

标签: mysql sql

MySQL在没有指定错误原因的情况下抛出了错误。丢回了这个声明

@Test
void test() {
    assert(source.read().equals(source.read().toLowerCase()));
}

我创建表的代码是:

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

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

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")
)

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:3)

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

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