Question: Q 5 ( 1 5 Points ) Using the results, athletes, and teams tables, find the number of times athletes or teams from each country
Q Points
Using the results, athletes, and teams tables, find the number of times athletes or teams from each country have finished in the top five on each date.
Specifically:
For each entry in the results table, if the participant is an individual athlete, use the countrycode from the athletes table; if the participant is a team, use the countrycod from the teams table.
Only consider participants with a rank of or smaller.
When counting appearances, only consider records from the results table where rank is no null.
eg The rank for "Table Tennis" discipline is null. Therefore, you don't need to conside records of Table Tennis.
Exclude days where all rank values are null from the output.
In case of a tie in the number of appearances, select the country that comes first alphabetically. Keep the original format of the date.
Your query should return the following columns:
date the date of the event
countrycode the country code associated with each athlete or team
appearances the count of topfive placements by athletes or teams from each country on each date
Sort the results by date ascendingly and countrycode alphabetical ascendingly.
Hints:
Ensure that each team is counted only once per event by selecting distinct values from the teams table where necessary.
Example Output:
tabledatecountrycode,appearancesCHNFRA,GER,IND,KOR,MEX,TPE,TUR,USA,AIN,ALG,AND,ANT,ARG,
If theres any more information i need to provide please let me know thank you!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
