Recap - RANK & DENSE_RANK
Parte de la sección Fundamentos del Journey de SQL de Coddy — lección 66 de 72.
Desafío
IntermedioTablas y columnas disponibles:
<strong>medals</strong>:<strong>region</strong>,<strong>medal_color</strong>,<strong>medal_count</strong>
Las regiones reciben medallas en competiciones. Crea un informe que muestre:
- Calcula para cada región:
total_medals: La suma de todas las medallas que tienenrank_by_medals: Crea un rango denso basado en total_medals en orden ascendente (regiones con menos medallas obtienen mejores/rangos más bajos)
- Ordena los resultados por:
rank_by_medals(ascendente)region(alfabéticamente)
devuelve:
regiontotal_medalsrank_by_medals
Pruébalo tú mismo
Todas las lecciones de Fundamentos
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