Recap - Books
Coddy SQL 여정의 기초 섹션에 포함된 레슨 — 72개 중 71번째.
챌린지
쉬움사용 가능한 테이블 및 컬럼:
<strong>books</strong>:<strong>book</strong>,<strong>page</strong>,<strong>words</strong>
책은 여러 페이지를 가지고 있으며, 각 페이지는 많은 단어를 가지고 있습니다.
이 챌린지에서는 각 책의 각 페이지까지의 누적 메트릭을 계산합니다. 다음 단계를 따르세요:
- 먼저, 각 책의 각 페이지까지의 다음 누적 집계 값을 계산하세요:
- Total words (
total_words) - Maximum words (
max_words) - Minimum words (
min_words) - Average words (
avg_words)
- Total words (
- 그 다음, 책 내 각 페이지에 대해 비율을 계산하세요:
(avg_words - min_words)/(total_words - min_words) - 마지막으로, 각 책에 대해:
- 이 비율을 기준으로 페이지를 오름차순으로 밀집 순위(DENSE_RANK)하세요 (이 컬럼을
ratio_rank이라고 하세요) - 결과를 먼저 book에 의해, 그 다음
ratio_rank에 의해 정렬하세요
- 이 비율을 기준으로 페이지를 오름차순으로 밀집 순위(DENSE_RANK)하세요 (이 컬럼을
참고: 모든 집계(total, max, min, avg)는 누적적이어야 하며, 각 책의 현재 페이지를 포함하여 그 페이지까지의 모든 페이지를 고려해야 합니다.
직접 해보기
기초의 모든 레슨
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 columns