简体   繁体   中英

SQL:number of supplied values does not match table definition. From what I can see it does though?

So I have created the table Orders then inserted the values but I keep getting this error.

Column name or number of supplied values does not match table definition.

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)

Anyone have any idea whats going on? Thanks

Issue was resolved, It was due to the order I was inserting values into my tables. Order had data inserted before Staff which caused a Key conflict. Cheers for help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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