Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE I NEED HELP FOR THIS ASSIGNMENT AND USE XAMPP In this homework, you will get started on how to create and use a relational

PLEASE I NEED HELP FOR THIS ASSIGNMENT AND USE XAMPP

In this homework, you will get started on how to create and use a relational DBMS. You can either use the MySQL system. You will write SQL (Standard Query Language) to create the relations, insert rows into the relations.

1. Create a database with name SOCCER____.

2. Create the following tables for your database (World cup 2014 information) whose schema diagram is specified in Page 3 of this document: COUNTRY, PLAYER, MATCH_RESULTS, PLAYER_ASSISTS_GOALS, PLAYER_CARDS. Write your Data definition language Query to create the relations (tables). Specify appropriate key and referential integrity constraints in your data definition language. The data types for each attribute are given after the schema diagram.

3. Write Insert query to load the records to the tables from input file. You can write each insert query manually or you can write a program that will generate the query by reading inputs from file. In the second case, save the file as .sql extension, and import the file into your MySQL service to run the sql.

4. Write down the queries in SQL for the English queries that are listed later (Page 2). Execute each query and display its results. Save the query and results in a text file.

5. Execute 3 more Insert commands in SQL that attempt to insert 3 more records, such that the records violate the integrity constraints. Make each of the 3 records violate a different type of integrity constraint. Save your commands in a text file.

6. Execute a command in SQL to Delete a record that violates a referential integrity constraint. Save your commands in a text file.

7. Repeat 5, but Insert three new records that do not violate any integrity constraints. Save your commands in a text file.For item 1,2 and 3: export your database. This will generate a file with .sql extension. For item 4,5,6 and 7: save all the commands and results in a text file.

For item 4)Apply the following queries in SQL and display the result of each query

1. Retrieve the name, club, and position for the players whose country is USA

2. Retrieve the names of countries participating in the 2014 world cup (this database) that have won the world cup at least once.

3. Retrieve the names of countries participating in the 2014 world cup (this database) that have never won the world cup.

4. Retrieve the name and country of the player with the most yellow cards in the 2014 world cup.

5. For each Host city, retrieve the HostCity and the total number of games played in that city.

6. For each country, retrieve the country name and the number of games they played as Team1 in the MATCH_RESULTS table, and the total goals scored (SUM of Team1_score) and the goals against (SUM of Team2_score).

7. For each country, retrieve the country name and the number of games they played as Team2 in the MATCH_RESULTS table, and the total goals scored (SUM of Team12_score) and the goals against (SUM of Team1_score)..

8. Find all the matches played with country Brazil as Team1 or Team2.

9. Retrieve the names of the players who have scored at least one goal, the players country, and the number of goals each player scored. Order the result by number of goals scored in descending order.

10. Repeat 9. but only for the players who have more than 2 goals.

COUNTRYCountry_NamePopulationNo_of_Worldcup_wonManagerPLAYERSPlayer_idNameFnameLnameDOBCountryHeightClubPositionCaps_for_countryIs_captainMATCH_RESULTSMatch_idDateStart_timeTeam1Team2Team1_scoreTeam2_scoreStadiumHost_cityPLAYER_CARDPlayer_idNo_of_Yellow_cardsNo_of_Red_cardsPLAYER_ASSISTS_GOALSPlayer_idNo_of_MatchesGoalsAssistsMinutes_Played

COUNTRY table attribute data types:

Country_Name Varchar(20),

Population decimal(10,2),

No_of_Worldcup_won int,

Manager varchar (20),

PLAYERS table attribute data types:

Player_id int,Name varchar (40),

Fname varchar (20),

Lname varchar (35),

DOB date,

Country varachar(20),

Height(cms) int,

Club varchar(30),

Position varchar(10),

Caps_for_Country int,

IS_CAPTAIN int.MATCH_RESULTS table attribute data types:

Match_id int,

Date_of_Match date,

Start_Time_Of_Match time,

Team1 varchar(25),

Team2 varchar(25),

Team1_score int,

Team2_score int,

Stadium_Name varchar(35),

Host_City varchar(20).

PLAYER_CARDS table attribute data types:

Player_id int,

Yellow_Cards int,

Red_Cards int.

PLAYER_ASSISTS_GOALS table attribute data types:

Player_id int,

No_of_Matches int,

Goals int,

Assists int,

Minutes_Played int

INPUT_Data:

country.csv

image text in transcribed

player.csvimage text in transcribed

player_assists_goals.csv

image text in transcribed

playercards.csv

image text in transcribed

match_results.csv

image text in transcribed

Australia' 'Iran' Japan' 'South Kor 'Algeria' 'Cameroor 'Ghana' 'Ivory Coa: 'Nigeria' 'Costa Rica 'Honduras 'Mexico' 'USA 'Argentina 'Brazil 'Chile' - Columbia 'Ecuador' e 'Uruguay' 'Belgium Bosnia &1 'Croatia' 'England' 'France' = 'Germany 5 'Greece -'Italy' 23.59 77.97 127.06 50.42 39.9 23.03 25.9 20.32 173.6 4.87 8.09 122.3 318.9 42.3 202.4 17.62 49.14 15.98 3.42 11.2 3.83 4.25 53.5 64.6 82.6 11.2 61.07 O 'Ange Postecoglou' o Carlos Queiroz' O 'Alberto Zaccheroni' O'Hong Myung-bo' o "Vahid Halilhodzic' o "Volker Finke' O'James Kwesi Appiah' O 'Sabri Lamouchi' O 'Stephen Keshi' o Jorge Luis Pinto' O 'Luis Fernando Suarez' o 'Miguel Herrera O Jurgen Klinsmann' 2 'Alejandro Sabella' 5 'Luiz Felipe Scolari' o Jorge Sampaoli' o Jose Pekerman' O 'Reinaldo Rueda' 2 'Oscar Tabarez' O Marc Wilmots' O'Safet Susic O 'Niko Kovac 1 'Roy Hodgson' 1 'Didier Deschamps' 4 Joachim Low' O'Fernando Santos' 4 'Cesare Prandelli 354875|'ABDELMC 'ABDELMC'DJABOU' '1987-01-3 'Algeria' 198243 'ABEL AGU'ABEL' 'AGUILAR' '1985-01-C 'Columbia' 305372 'ABEL HER 'ABEL' 'HERNAND '1990-08-C 'Uruguay' 379972 'ACQUAH 'ACQUAH' 'AFRIYIE' '1992-05-C 'Ghana' 353237 'ADAM KW 'ADAM' 'KWARASE '1987-12-1 'Ghana' 361222 'ADAM LAL ADAM' "LALLANA' '1988-05-1 'England' 368902 'ADAM TA'ADAM' 'TAGGART '1993-06-C 'Australia' 356409 'ADMIR M'ADMIR' "MEHMED '1991-03-1'Switzerlar 379910 'ADNAN JA'ADNAN' 'JANUZAJ' '1995-02-C 'Belgium' 349568 'ADRIAN B 'ADRIAN' 'BONE' '1988-09-C'Ecuador' 200847 'ADRIAN R 'ADRIAN' 'RAMOS' '1986-01-2 'Columbia 274703 'AGUSTIN AGUSTIN''ORION' '1981-07-2 'Argentina 295153 'AHMAD A 'AHMAD' 'ALNAMEF '1982-10-2 'Iran' 344714 'AHMED M'AHMED' "MUSA' '1992-10-1 'Nigeria' 376285 'AISSA MAAISSA' 'MANDI' '1991-10-2 'Algeria' 302539 'ALAN DZA 'ALAN' 'DZAGOEV '1990-06-1 'Russia' 336722 'ALAN PUL 'ALAN' 'PULIDO' '1991-03-C 'Mexico' 364707 'ALBERT A 'ALBERT' 'ADOMAH' 1987-12-1'Ghana' 215623 'ALBERTO 'ALBERTO''AQUILANI '1984-07-C'Italy' 181698 'ALDO RAN'ALDO' 'RAMIREZ' '1981-04-1 Columbia' 296273 'ALEJANDF'ALEJANDF'BEDOYA' '1987-04-2 'USA' 186808 'ALEKSANC'ALEKSANC 'KERZHAKO '1982-11-2 'Russia' 369983 'ALEKSEI K ALEKSEI' 'KOZLOV' '1986-12-2 'Russia' 228942 'ALESSIO C'ALESSIO' 'CERCI' '1987-07-2'Italy' 336869 'ALEX IBAF 'ALEX' 'IBARRA' '1991-01-2 'Ecuador 356198 'ALEX OXL'ALEX' 'OXLADE C'1993-08-1 'England' 182620 'ALEX WILI 'ALEX' 'WILKINSC '1984-08-1 'Australia' 168 'Club Afric: 'Forward' 187 'Toulouse 'Midfielder 186 'US Citta d'Forward' 162 'Parma FC Midfielder 190 'Stromsgo 'Goalkeep 179 'Southamp Midfielder 172 'Newcastle'Forward' 183 SC Freibur 'Forward' 180 Manchest Midfielder 188 'CD El Nac 'Goalkeepe 184 'Hertha BS 'Forward' 190 CA Boca J 'Goalkeepe 189 'Naft Tehr: 'Defender' 176 'CSKA Mos 'Forward' 184 'Stade de F'Defender' 178 'CSKA Mos 'Midfielder 176 'Tigres UAI'Forward' 162 'Middlesbr 'Midfielder 184 'ACF Fiore. 'Midfielder 175 'CA Monar 'Midfielder 178 'FC Nantes 'Midfielder 175 'FC Zenit S 'Forward' 185 'FC Dynam 'Defender' 177 'Torino FC 'Forward' 171 'Vitesse Ar 'Midfielder 180 'Arsenal FC Midfielder 183 'Jeonbuk + 'Defender' 7 FALSE 48 FALSE 12 FALSE 4 FALSE 21 FALSE 4 FALSE 4 FALSE 21 FALSE 0 FALSE 3 FALSE 25 FALSE 3 FALSE 9 FALSE 37 FALSE 2 FALSE 32 FALSE 5 FALSE 14 FALSE 34 FALSE 29 FALSE 26 FALSE 80 FALSE 10 FALSE 11 FALSE 17 FALSE 14 FALSE 2 FALSE Ji 2 400 7 682 6 5 4 4 5 5 458 548 6 269058 321722 314197 217315 229397 306548 373400 321653 7 4 693 245 6 3 270 4 387 450 297103 UT 690 159 2 3 N 167 184616 213001 353118 354875 336098 270775 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 3 169 st N 173 2 1 0 1 3 0 0 3 1 0 0 1 1 0 0 0 0 1 0 1 1 0 1 0 0 2 N 178 375518 2 180 3 194 6 258 258 3 3 3 N 262 3 313832 309316 359381 294620 290186 208353 182206 354859 344714 207851 228627 3 2 5 3 5 4 4 4 2 2 2 2 2 263 270 281 324 335 387 N 4 N 390 0 1 1 2 0 0 0 0 1 1 1 1 1 1 1 1 2 3 0 1 1 0 1 0 2 0 298664 312987 369058 290824 200261 275931 209827 214887 286481 202544 269058 314197 217315 306548 373400 184616 213001 214876 312868 184615 300411 207528 301059 307849 197514 291393 208016 1 0 1 0 1 0 2 0 1 0 1 2 3 1 2 0 0 0 0 0 0 0 0 0 1 2 1 1 3 3 2 3 1/'2014-06-1'17:00:00' 'Brazil' 'Croatia' 2 '2014-06-1'13:00:00' 'Mexico' 'Cameroor 3 '2014-06-1'16:00:00' 'Spain' 'Netherlan 4 '2014-06-1'18:00:00' 'Chile' 'Australia' 5 '2014-06-1'13:00:00' Columbia 'Greece' 6 '2014-06-1'22:00:00' 'lvory Coa: 'Japan' 7 '2014-06-1'16:00:00' 'Uruguay' 'Costa Rica 8 "2014-06-1'18:00:00' 'England' 'Italy' 9 '2014-06-1'13:00:00' 'Switzerlar 'Ecuador' 10 '2014-06-1'16:00:00' 'France' 'Honduras 11 '2014-06-1'19:00:00' 'Argentina Bosnia & I 12 '2014-06-1'16:00:00' 'Iran' 'Nigeria' 13 2014-06-1'13:00:00' 'Germany' 'Portugal 14 "2014-06-1'19:00:00' 'Ghana' 'USA 15 '2014-06-1'13:00:00' 'Belgium' 'Algeria' 16 '2014-06-1'18:00:00' 'Russia' 'South Kor 17 "2014-06-1'16:00:00' 'Brazil' 'Mexico' 18 "2014-06-1'18:00:00' 'Cameroor 'Croatia' 19 '2014-06-1'16:00:00' 'Spain' 'Chile 20 "2014-06-1'13:00:00' 'Australia' 'Netherlan 21 2014-06-1'13:00:00' Columbia' 'Ivory Coa: 22 '2014-06-1'19:00:00' Japan' 'Greece 23 '2014-06-1'16:00:00' 'Uruguay' 'England' 24 '2014-06-2 '13:00:00' 'Italy' 'Costa Rica 25 '2014-06-2'16:00:00' 'Switzerlar 'France' 26 '2014-06-2'19:00:00' 'Honduras "Ecuador 27 '2014-06-2 '13:00:00' 'Argentina' 'Iran' 3 1 1 3 3 2 1 1 2 3 2 0 4 1 2 1 0 0 0 2 2 0 2 0 2 1 1 1 'Arena de Sao Paulo' O 'Estadio da 'Natal' 5 'Arena Fon 'Salvador 1 'Arena Pan 'Cuiaba' O 'Estadio M 'Belo Horizonte 1 'Arena Per 'Recife' 3 'Estadio C'Fortaleza' 2 'Arena Am 'Manaus' 1 'Estadio N 'Brasilia' O'Estadio Be 'Porto Alegre' 1 'Estadio dc 'Rio De Janerio' o 'Arena Da 'Curitiba' o 'Arena Fon Salvador 2 'Estadio da 'Natal' 1 'Estadio M 'Belo Horizonte' 1 'Arena Pan 'Cuiaba' o 'Estadio Ca'Fortaleza 4 'Arena Am 'Manaus! 2 'Estadio dc 'Rio De Janerio' 3 'Estadio Be 'Porto Alegre' 1 'Estadio N 'Brasilia' O'Estadio da 'Natal' 1 'Arena de Sao Paulo' 1 'Arena Per 'Recife' 5 'Arena Fon 'Salvador 2 'Arena Da 'Curitiba' O 'Estadio M 'Belo Horizonte

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Multidimensional Array Data Management In Databases

Authors: Florin Rusu

1st Edition

1638281483, 978-1638281481

More Books

Students also viewed these Databases questions

Question

Identify three ways to manage an intergenerational workforce.

Answered: 1 week ago

Question

Prepare a Porters Five Forces analysis.

Answered: 1 week ago

Question

Analyze the impact of mergers and acquisitions on employees.

Answered: 1 week ago