What is the script i would need to create this table? I keep getting an error wh
ID: 3776614 • Letter: W
Question
What is the script i would need to create this table? I keep getting an error when i try.
Create the champs table. The column names and types are listed below. Create an index for the team_id as noted. Be sure to make champ_id a PRIMARY KEY. Create a FOREIGN KEY as noted (10 Points): champ_id MEDIUMINT UNSIGNED NOT NULL AUTO INCREMENT PRIMARY KEY (This will store an id for each record in the championships table.) team_id MEDIUMINT UNSIGNED NOT NULL INDEX (This will store the team_id same as that used in the teamstats table.) pennants MEDIUMINT UNSIGNED NOT NULL (The number of pennants won by the team.) worldseries MEDIUMINT UNSIGNED NOT NULL (The number of World Series won by the team.) FOREIGN KEY team_id REFERENCES teamstats (team_id) ON DELETE NO ACTION ON UPDATE NO ACTION
Explanation / Answer
Below is the datatable script to create the above mentioned table :-
CREATE TABLE champs(
champ_id MEDIUMINT UNSIGNED NOT NULL,
team_id MEDIUMINT UNSIGNED NOT NULL,
pennants MEDIUMINT UNSIGNED NOT NULL,
worldseries MEDIUMINT UNSIGNED NOT NULL,
PRIMARY KEY (champ_id),
FOREIGN KEY (team_id) REFERENCES teamstats(team_id),
INDEX team_index (team_id)
);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.