Mysql error no 1064

Hello,

Following is a script generated directly by MySql Workbench:

CREATE TABLE IF NOT EXISTS `testDB`.`tb_user` (
`id_user` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT ,
`ch_username` CHAR(15) NOT NULL ,
`ui_userType` INT UNSIGNED NULL ,
PRIMARY KEY (`id_user`) ,
UNIQUE INDEX `idx_ch_username` (`ch_username` ASC) ,
INDEX `fk_user_usertype` (`ui_userType` ASC) ,
CONSTRAINT `fk_user_usertype`
FOREIGN KEY (`ui_userType` )
REFERENCES `testDB`.`tb_userType` ()
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;

When running this script in query browser, or command line, it gives me this error:
Error No: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 ')
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB' at line 10

I can not see any syntax error.
Any help would be appreciated
ZiphyreAsked:
Who is Participating?
 
UmeshConnect With a Mentor MySQL Principle Technical Support EngineerCommented:
Column name missing..

REFERENCES `testDB`.`tb_userType` (COLUMN_NAME_HERE)
CREATE TABLE IF NOT EXISTS `testDB`.`tb_user` (
`id_user` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT ,
`ch_username` CHAR(15) NOT NULL ,
`ui_userType` INT UNSIGNED NULL ,
PRIMARY KEY (`id_user`) ,
UNIQUE INDEX `idx_ch_username` (`ch_username` ASC) ,
INDEX `fk_user_usertype` (`ui_userType` ASC) ,
CONSTRAINT `fk_user_usertype`
FOREIGN KEY (`ui_userType` )
REFERENCES `testDB`.`tb_userType` () ON DELETE NO ACTION ON UPDATE NO ACTION)ENGINE = InnoDB; 

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.