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

Question 2 [35%] Consider the following two tables, TEAMID TEAMNAME MATCHDATE HO

ID: 3715014 • Letter: Q

Question

Question 2 [35%] Consider the following two tables, TEAMID TEAMNAME MATCHDATE HOME AWAY HOMESCORE AWAYSCORE Riders Motors Eagles Panthers Knights Suns Sonics Warriors Lions 12/9/2015 12/9/2015 13/9/2015 13/9/2015 18/9/2015 19/9/2015 19/9/2015 26/9/2015 26/9/2015 27/9/2015 27/9/2015 4 3 (a) Write a SQL statement to return the total number of home game(s) (including home and away games) did the team, with TEAMID as 4, played. Note that the returned value is shown in the expression as TOTALGAME. [3%] (b) Write a SQL statement to show the average score among all home games of team with TEAMID as 8. Note that the returned value is shown in the expression as AVGSCORE. [396] (c) Write a SQL statement to return total number of game(s) did the team Eagles played. Note that the returned value is shown in the expression as TOTALGAME. [5%]

Explanation / Answer

Solution

a) SELECT COUNT(MATCHDATE) AS TOTALGAME FROM RECORD WHERE

HOME = 4 OR AWAY = 4;

b) SELECT AVG(HOMESCORE) AS AVGSCORE FROM RECORD WHERE HOME = 8;

c) SELECT COUNT(MATCHDATE) AS TOTALGAME FROM RECORD WHERE HOME =

(SELECT TEAMID FROM TEAM WHERE TEAMNAME = "Eagles") OR AWAY =

(SELECT TEAMID FROM TEAM WHERE TEAMNAME = "Eagles");

Feel free to reach out regarding any queries . And please do rate the answer . Thank you .

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