Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What is wrong with this? CREATE TABLE participation ( team_id int(11) not null,

ID: 3824374 • Letter: W

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,
   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

#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

Explanation / Answer

Note:

above query is i coorected syntacticaly but there is a problem ,have you created team table because you are referencing that table in foregin key constraint so please check once .

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote