Question: What is wrong with this? CREATE TABLE participation ( team_id int(11) not null, driver_id int(11) not null, race_id int(11) not null, points_earned int(11) not null,
What is wrong with this?
CREATE TABLE participation ( team_id int(11) not null, driver_id int(11) not null, race_id int(11) not null, points_earned int(11) not null, CONSTRAINT par_pk1 PRIMARY KEY (team_id, driver_id, race_id), CONSTRAINT par_fk1 FOREIGN KEY (team_id), REFERENCES team (team_id) ON update cascade CONSTRAINT par_fk2 FOREIGN KEY (driver_id) REFERENCES driver (driver_id) ON update cascade CONSTRAINT par_fk3 FOREIGN KEY (race_id) REFERENCES team (race_id) ON update cascade ) Engine=innoDBCREATE TABLE participation ( team_id int(11) not null, driver_id int(11) not null, race_id int(11) not null, points_earned int(11) not null, CONSTRAINT par_pk1 PRIMARY KEY (team_id, driver_id, race_id), CONSTRAINT par_fk1 FOREIGN KEY (team_id), REFERENCES team (team_id) ON update cascade CONSTRAINT par_fk2 FOREIGN KEY (driver_id) REFERENCES driver (driver_id) ON update cascade CONSTRAINT par_fk3 FOREIGN KEY (race_id) REFERENCES team (race_id) ON update cascade ) Engine=innoDB
Error:
Static analysis:
3 errors were found during analysis.
A symbol name was expected! (near "REFERENCES" at position 258)
Unexpected beginning of statement. (near "team_id" at position 275)
Unrecognized statement type. (near "ON update" at position 284)
SQL query:
CREATE TABLE participation ( team_id int(11) not null, driver_id int(11) not null, race_id int(11) not null, points_earned int(11) not null, CONSTRAINT par_pk1 PRIMARY KEY (team_id, driver_id, race_id), CONSTRAINT par_fk1 FOREIGN KEY (team_id), REFERENCES team (team_id) ON update cascade CONSTRAINT par_fk2 FOREIGN KEY (driver_id) REFERENCES driver (driver_id) ON update cascade CONSTRAINT par_fk3 FOREIGN KEY (race_id) REFERENCES team (race_id) ON update cascade ) Engine=innoDB
MySQL said:
#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 team (team_id) ON update cascade CONSTRAINT par_fk2 FOREIGN KEY (' at line 7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
