我试图在phpMyAdmin中执行一个查询,但它给了我一个错误说:
1064 - 您的SQL语法出错;检查手册 对应于您的MySQL服务器版本,以便使用正确的语法 靠近') 参考
Online Shopping
。Customer
() 无法删除操作 '在第11行
查询是:
CREATE TABLE IF NOT EXISTS `Online Shopping`.`Order_Details` (
`Order_Id` INT NOT NULL ,
`Product_Name` VARCHAR(45) NULL ,
`Price_For_Each_Product` VARCHAR(45) NULL ,
`No_of_Product_ordered` VARCHAR(45) NULL ,
`Ordered_Date` DATE NULL ,
`Total_Price` VARCHAR(45) NULL ,
`Generated_Key` VARCHAR(45) NULL ,
PRIMARY KEY (`Order_Id`) ,
CONSTRAINT `Customer_Id`
FOREIGN KEY ()
REFERENCES `Online Shopping`.`Customer` ()
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `Order_LineId`
FOREIGN KEY ()
REFERENCES `Online Shopping`.`Order_Line` ()
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
答案 0 :(得分:0)
CREATE TABLE IF NOT EXISTS `Online Shopping`.`Order_Details` (
`Order_Id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT ,
`Product_Name` VARCHAR(45) NULL ,
`Price_For_Each_Product` VARCHAR(45) NULL ,
`No_of_Product_ordered` VARCHAR(45) NULL ,
`Ordered_Date` DATE NULL ,
`Total_Price` VARCHAR(45) NULL ,
`Generated_Key` VARCHAR(45) NULL,
CONSTRAINT `Customer_Id`
FOREIGN KEY (Customer_ID)
REFERENCES `Online Shopping`(Customer)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `Order_LineId`
FOREIGN KEY (Customer_ID)
REFERENCES `Online Shopping`(Order_Line)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;