Description

5/5 - (2 votes)

player (playerID: int, firstName: nvarchar(25), lastName: nvarchar(25), nationality: varchar(25), birthDate:

smalldatetime, age: smallint, position: varchar(25))

 

team (teamID: int, name: nvarchar(50), city: nvarchar(25))

 

player_team (playerID: int, teamID: int, season: varchar(5))

 

match (matchID: int, homeTeamID: int, visitingTeamID: int, dateOfMatch: smalldatetime, week: tinyint)

 

goals (matchID: int, playerID: int, isOwnGoal: bit, minute: tinyint)

 

Notes:

 

Table match stores data only for season 2013-2014. Table goals stores data only for season 2013-2014.

 

 

  • [0 pts] Restore the database TurkishSuperLeague using the file bak that has been e-mailed to you. Write the following SQL queries, in only one statement, using this database. For each of the following query, take a screenshot of both your SQL query and output of the query on MS SQL Server.

 

  • [10 pts] Update the field age for all players.

 

 

  • [20 pts] List the “younger” players whose first name does not contain “nec” and play in “Beşiktaş”. “Younger” players are the ones whose ages are less than the average age of all players. Retrieve playerID, firstname + ” “ + lastname.

 

 

  • [30 pts] Update all city values of the table team as: “city” + “ #p” + “number of players” +” g” + “number of goals forward” (e.g. “İstanbul #p25 g74”). Do not forget to include own goals in your calculations.

 

 

  • [40 pts] List the top 10 top scorers. Retrieve playerID, first name, last name, number of goals scored, number of matches that player did not score a goal, average number of goals per scored matches.

 

Compress your screenshots in a zip file. Name it as hw4-lastname-firstname.zip and submit it.

1/1