2015-09-06 203 views
0

嗨,大家我無法找到將值插入表中時的錯誤。MYSQL - 錯誤:#1064

它一直顯示錯誤「#1064 - 你的SQL語法錯誤;查看與你的MySQL服務器版本相對應的手冊,在正確的語法附近使用'('1000000001','CASH',' PAID','2015-09-05 12:58:51','100000','10000005'), ('10000'at line 2 「

下面的代碼是將值插入到表調用order:,

INSERT INTO `ORDER` VALUES 
     (`Order_ID`, `Pay_Method`, `Pay_status`, `Order_Time`, `Cus_ID`, `Emp_ID`) 
     ('1000000001','CASH','PAID','2015-09-05 12:58:51','100000','10000005'), 
     ('1000000002','CASH','PAID','2015-09-05 14:45:00','100001','10000008'), 
     ('1000000003','CREDIT CARD','PAID','2015-09-05 16:34:21','100002','10000001'), 
     ('1000000004','CASH','PAID','2015-09-05 17:10:10','100003','10000008'), 
     ('1000000005','CREDIT CARD','PAID','2015-09-06 12:33:11','100004','10000006'), 
     ('1000000006','CREDIT CARD','PAID','2015-09-06 15:51:15','100006','10000003'), 
     ('1000000007','CASH','PAID','2015-09-06 16:20:05','100007','10000002'), 
     ('1000000008','','UNPAID','2015-09-06 17:00:00','100005','10000005'), 
     ('1000000009','','UNPAID','2015-09-06 17:23:15','100008','10000001'), 
     ('1000000010','','UNPAID','2015-09-06 17:30:34','100009','10000006') 

,這是創建表的編碼:(創建成功)

CREATE TABLE `ORDER` (
     Order_ID CHAR(10) PRIMARY KEY, 
     Pay_Method ENUM ('CASH','CREDIT CARD') NOT NULL, 
     Pay_status ENUM ('PAID','UNPAID') NOT NULL, 
     Order_Time DATETIME NOT NULL, 
     Total_Price DECIMAL(6,2) NOT NULL, 
     Cus_ID CHAR(6) NOT NULL, 
     FOREIGN KEY (Cus_ID) REFERENCES CUSTOMER(Cus_ID) ON DELETE CASCADE ON UPDATE CASCADE, 
     Emp_ID CHAR(8) NOT NULL, 
     FOREIGN KEY (Emp_ID) REFERENCES EMPLOYEE(Emp_ID) ON DELETE CASCADE ON UPDATE CASCADE 

我沒有插入的Total Price的值,因爲我將它插入以後。

預先感謝您。

+0

值應該來字段列表後.. – amdixon

+0

側面說明,不理想的保留字來命名錶 –

回答

2
INSERT INTO `ORDER` 
(`Order_ID`, `Pay_Method`, `Pay_status`, `Order_Time`, `Cus_ID`, `Emp_ID`) 
VALUES 

     ('1000000001','CASH','PAID','2015-09-05 12:58:51','100000','10000005'), 
     ... 
2

字段來表名之後:

INSERT INTO _table_ (field1, field2, ...) VALUES (...) 
+0

對我來說很好 – Drew