1

MySQL is throwing error back without specifying what the error is. 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 :

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.

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.