Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysql workbench Error while applying SQL script to the database

Operation failed: There was an error while applying the SQL script to the database.

ERROR 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') REFERENCES ad_d19fb99c240e6c8.user () ON DELETE NO ACTION ON U' at line 10

SQL Statement:

CREATE TABLE `ad_d19fb99c240e6c8`.`instructor_profile` (
  `InstructorId` INT NULL,
  `InstructorName` VARCHAR(45) NULL,
  `companyId` INT NULL,
  `companyName` VARCHAR(45) NULL,
  `instructorEmail` VARCHAR(45) NULL,
  `ManagerName` VARCHAR(45) NULL,
  `ManagerEmail` VARCHAR(45) NULL,
  CONSTRAINT `UserId`
    FOREIGN KEY ()
    REFERENCES `ad_d19fb99c240e6c8`.`user` ()
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `VendorId`
    FOREIGN KEY ()
    REFERENCES `ad_d19fb99c240e6c8`.`vendor` ()
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
like image 856
learning developer Avatar asked Dec 31 '25 19:12

learning developer


2 Answers

You must put a column name inside the parentheses, as others have said. This must match one of the column names previously given in your CREATE TABLE statement.

like image 114
Code-Apprentice Avatar answered Jan 03 '26 10:01

Code-Apprentice


You're missing the column you want to reference and the column of the FK :

 CONSTRAINT `UserId`
      FOREIGN KEY (<TheColumn>)
      REFERENCES `ad_d19fb99c240e6c8`.`user` (<TheColumnInTheOtherTable>)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION,
 CONSTRAINT `VendorId`
      FOREIGN KEY (<TheSecondColumn>)
      REFERENCES `ad_d19fb99c240e6c8`.`vendor` (<TheSecondColumnInTheOtherTable>)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION)
like image 26
sagi Avatar answered Jan 03 '26 08:01

sagi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!