phpMyAdmin - 执行查询时出现1064错误

时间:2016-04-06 09:50:01

标签: mysql sql

我试图在phpMyAdmin中执行一个查询,但它给了我一个错误说:

  

1064 - 您的SQL语法出错;检查手册   对应于您的MySQL服务器版本,以便使用正确的语法   靠近')       参考Online ShoppingCustomer()       无法删除操作       '在第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;

1 个答案:

答案 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;