Recap - RANK & DENSE_RANK
CoddyのSQLジャーニー「基礎」セクションの一部 — レッスン 66/72。
チャレンジ
中級利用可能なテーブルと列:
<strong>medals</strong>:<strong>region</strong>,<strong>medal_color</strong>,<strong>medal_count</strong>
地域は競技会でメダルを受け取ります。以下の内容を示すレポートを作成してください:
- 各地域について計算:
total_medals:その地域が獲得したすべてのメダルの合計rank_by_medals:total_medals を昇順で基準とした密なランク(メダル数の少ない地域がより良い/低いランクになる)
- 結果を次の順序で並べ替え:
rank_by_medals(昇順)region(アルファベット順)
返す:
regiontotal_medalsrank_by_medals
自分で試してみよう
基礎のすべてのレッスン
4More Keywords
The IN keywordThe BETWEEN keywordThe LIKE keywordThe AS keywordRecap - Cellphone Models2Conditions
Conditions BasicsThe AND keywordThe OR keywordThe NOT keywordMultiple Conditions CombinedParenthesisBooleans5Arithmetic Operations
Mathematical OperatorsMathematical ColumnsThe Modulo OperationThe ROUND() Function3Specific Return Format
Null valuesSort Results Part 1Sort Results Part 2Recap - Cyber Security FirmLimit number of recordsRecap - Vehicle Factory6Intro Challenges
Recap - Parliamentary ElectionRecap - Police Criminal ArrestRecap - Bar Beverage ContainerRecap - Engineer new columns9Multiple tables
Basic Join Part 1Basic Join Part 2Recap - JoinSelf joinRecap - Self JoinUnionSimplify queries, WITH keywordRecap - With QueriesRecap - Real Estate Contractor12Window Functions part 2
RANK & DENSE_RANK FunctionsRecap - RANK & DENSE_RANKNTILE FunctionAggregation FunctionsROWS & RANGE Criterion