[英]SQL:number of supplied values does not match table definition. From what I can see it does though?
因此,我創建了表Orders,然后插入了值,但是我一直收到此錯誤。
列名或提供的值數與表定義不匹配。
CREATE TABLE Orders
(
orderNo CHAR(8) PRIMARY KEY NOT NULL,
orderDate DATE NOT NULL,
customerID CHAR(8) FOREIGN KEY REFERENCES Customer(customerID),
employeeNumber CHAR(8) FOREIGN KEY REFERENCES Staff(employeeNumber) NOT NULL, --Could possibly be many to many but I just interperated it as the staff member who takes the order. So not including staff who make or deliver.
transactionID CHAR(8) FOREIGN KEY REFERENCES OrderPayments(transactionID) NOT NULL,
orderstatus BIT
)
INSERT INTO Orders VALUES ('ORDER001','2017-04-20','PAT00001','ROBBIE11','TRANS001',1)
有人知道發生了什么嗎? 謝謝
問題已解決,這是由於我在表中插入值的順序。 訂單在Staff之前插入了數據,從而導致密鑰沖突。 歡呼尋求幫助
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.