while executing the following query, i get an error that there\'s an error in the syntax near line 9. since i\'m using mysql workbench, i can\'t really figure out what could be
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 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.
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.