error in mysql syntax

一世执手 提交于 2019-12-02 07:12:40

The syntax error appears to be the empty parenthesis at: INDEX vAuthorID (), FOREIGN KEY () and REFERENCES proquotes.author_info (). Those parenthesis should reference one or more table attributes.

For example:

INDEX `vAuthorID` (`vAuthorID`) ,
CONSTRAINT `vAuthorID`
   FOREIGN KEY (`vAuthorID`)
   REFERENCES `proquotes`.`author_info` (`vAuthorID`)

The last parenthesis for the REFERENCES clause should reference an attribute in author_info, and not from thquotes. Therefore you may need to change vAuthorID accordingly.

It looks like you need a column name in the parentheses after the INDEX keyword?

See http://dev.mysql.com/doc/refman/5.5/en/create-table.html.

The three obvious errors are a lack of fields in your INDEX and FOREIGN KEY definitions. You have to specify one or more fields for each, otherwise it's a syntax error.

INDEX `vAuthorID` () ,  <--need a field here in the ()'s
CONSTRAINT `vAuthorID`
    FOREIGN KEY ()  <---another field here in the ()'s
    REFERENCES `proquotes`.`author_info` ()  <--and yet another field here in the ()'s

You're also not specifying which database engine to use, which generally means MySQL will use MyISAM, so all of your foreign key specifications will be silently dropped.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!