简体   繁体   English

在 MySQL 中创建 SQL 表时面临错误

[英]Facing error while Creating a SQL table in MySQL

MySQL is throwing error back without specifying what the error is. MySQL 正在抛出错误,但未指定错误是什么。 It's throwing this statement back它把这个声明扔回去了

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

My Code for creating the table is:我创建表的代码是:

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

I have based if of the example code MySQL provides before table creation:我基于示例代码 MySQL 在创建表之前提供的 if:

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]

Any help would be appreciated.任何帮助,将不胜感激。

You need to remove double quotes and then it should work.您需要删除双引号,然后它应该可以工作。

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)
);
/

Here is the DEMO这是演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM