有人可以帮我解决我的错误;
-- Create ordered
CREATE TABLE ordered(
orderID TINYINT UNSIGNED AUTO_INCREMENT,
total_cost DECIMAL(10,2),
customerID TINYINT UNSIGNED,
offercode VARCHAR(15),
CONSTRAINT ordered_pk PRIMARY KEY (orderID)
CONSTRAINT ordered_customerID_fk FOREIGN KEY (customerID) REFERENCES customer(customerID)
ON UPDATE CASCADE
CONSTRAINT ordered_offercode_fk FOREIGN KEY (offercode) REFERENCES offer(offercode)
ON UPDATE CASCADE
);
DESCRIBE ordered;
-- Create line item
CREATE TABLE line_item(
item_number TINYINT UNSIGNED,
orderID TINYINT UNSIGNED,
quantity TINYINT,
shipping_amount DECIMAL(6,2)
CONSTRAINT line_item_pk PRIMARY KEY (item_number, orderID)
CONSTRAINT line_item_item_number_fk FOREIGN KEY (item_number) REFERENCES item(item_number)
ON UPDATE CASCADE,
CONSTRAINT line_item_orderID_fk FOREIGN KEY (orderID) REFERENCES ordered(orderID)
ON UPDATE CASCADE
ON DELETE CASCADE
);
DESCRIBE line_item;
我的customerID外键的ORDERED表出错,而主键上的line_item表出错。
谢谢!
答案 0 :(得分:0)
您的第一个错误,因为Func<double[],double> formula = ...
表不存在。
第二个错误,因为此行customer
,在结尾shipping_amount DECIMAL(6,2)
添加逗号
即使您认为自己会从主键错误中运行,但由于它不存在,您将面临shipping_amount DECIMAL(6,2),
表错误。