# Duolingo Leaderboards — SQL Interview Question

Aced (formerly Exponent) publishes a public search API over its indexed pages; the guide is at https://www.aced.io/agents/agent-access.

Source: https://www.aced.io/questions/3099/duolingo-leaderboards
Source observed: 2026-11-04T21:34:32.776Z
Last checked: 2026-11-04T21:34:32.776+00:00
Indexed: 2026-11-05T01:37:51.82+00:00

---

# Duolingo Leaderboards

**Difficulty:** Hard  
**Roles:** [Data Engineer](https://www.aced.io/questions?role=data-engineer), [Data Scientist](https://www.aced.io/questions?role=data-science), [Data Analyst](https://www.aced.io/questions?role=data-analyst)  
**Categories:** [Coding](https://www.aced.io/questions?type=coding), [SQL](https://www.aced.io/questions?type=sql)

We provide this SQL interview practice question about analyzing Duolingo lesson activity. Duolingo lets learners study languages through bite-sized lessons, complete multiple lessons per day, and track progress in a chosen language.

## Task

You are given three tables: `user`, `lesson`, and `lessons_completed`.

### `user`

| Column | Type |
| --- | --- |
| `user_id` | integer |
| `username` | string |
| … | … |

### `lesson`

| Column | Type |
| --- | --- |
| `lesson_id` | integer |
| `language` | string |
| … | … |

### `lessons_completed`

| Column | Type |
| --- | --- |
| `lesson_id` | integer |
| `user_id` | integer |
| `completed_date` | date |

Write a SQL query that returns the top three learners with the highest total number of completed lessons **for each language**, counting completions from **24 Sep 2023 through 30 Sep 2023**. The output must contain:

- `username`
- `language`
- `total_lessons`
- `rank`

### Ranking requirement

If learners tie and fall within the top three ranks, include all tied learners. Do not skip rank positions after a tie. For example, if three learners tie for first place in a language, the next learner is ranked second, not fourth. This requires dense-ranking behavior, such as `DENSE_RANK()` partitioned by `language` and ordered by `total_lessons` descending.

## Access and practice

The solution editor includes SQL practice controls, including an editor, output, test-results and console areas. Sign up to run code: [Sign up to run code](https://www.aced.io/signup?src=lesson). Detailed company statistics for this question require [Upgrade](https://www.aced.io/upgrade?src=questions).

## Related questions

- [Game Leaderboard](https://www.aced.io/questions/3067/game-leaderboard)
- [Design a leaderboard system.](https://www.aced.io/questions/4674/design-leaderboard-system)

## Related courses

### [Data Analyst Interview Prep](https://www.aced.io/courses/data-analytics)

We help candidates prepare for data analyst interviews across product, marketing and business analyst roles with real take-home case studies, technical and dashboarding practice, and strategies from interviewers at technology companies and startups.

### [Data Science Interview Prep](https://www.aced.io/courses/data-science)

We help candidates prepare for data science roles at companies including Google, Amazon, Microsoft, Meta and Apple. The course covers mock interviews, frameworks and advice from senior candidates, plus statistics, experimentation, coding, SQL, machine learning and behavioral interviews.

## Community responses

The question includes community SQL responses. These are separate member submissions rather than an official solution.

- **Yash B.** — October 27, 2026; 367 karma; [profile](https://www.aced.io/users/0c8f33fa-aec8-4243-a2ab-218465bb4355). Uses joins across the three tables, filters `completed_date` with `BETWEEN '2023-09-24' AND '2023-09-30'`, groups by language and learner, then applies `DENSE_RANK()` by language and filters ranks through 3.
- **Ashna P.** — September 21, 2026; 77 karma; [profile](https://www.aced.io/users/c7617584-bbd1-457b-b5b0-4d043a06602e). Uses three common table expressions, counts distinct lesson IDs, applies `DENSE_RANK()` by language, and orders the final results by language, rank and username.
- **Malak M.** — July 18, 2026; 118 karma; [profile](https://www.aced.io/users/515572de-e939-4d9a-821f-2052fd7eb0a8). Aggregates completed lessons by learner and language, ranks with `DENSE_RANK()`, and returns ranks up to 3.
- **Felipe P.** — July 21, 2026; 115 karma; [profile](https://www.aced.io/users/f6e0b139-36d1-4592-ae09-e30288a306ea). Uses a summary CTE and dense ranking, with a submitted query that contains naming and syntax inconsistencies in its final CTE reference.
- **Sushant M.** — updated May 11, 2026; 113 karma; [profile](https://www.aced.io/users/c5aeec66-7cbd-4003-b405-a5225d071cac). Aggregates completion counts, computes `DENSE_RANK()` over each language and filters to ranks no greater than 3.

## Navigation and account links

- [All Questions](https://www.aced.io/questions)
- [Log in](https://www.aced.io/login?src=nav)
- [Sign up](https://www.aced.io/signup?src=nav)
- [Aced home](https://www.aced.io/?src=nav)

---

[Read this page’s summary](https://www.aced.io/agents/api/public/v1/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F3099%2Fduolingo-leaderboards&trace=t_679ff9ab98f3)

## Ask a follow-up about this page

Need a more specific answer? Ask the exact question you have. It returns a fresh, cited answer from Aced (formerly Exponent)’s knowledge base. No account or API key required.

Open this URL with your own question, URL-encoded. Include your question in q. All research inputs are optional; no account or setup.

`GET https://www.aced.io/agents/agent/faq?q={question}&trace=t_679ff9ab98f3`

[Tool guide and examples](https://www.aced.io/agents/agent-access) · [OpenAPI](https://www.aced.io/agents/api/public/v1/openapi.json) · [Page TLDR form](https://www.aced.io/agents/agent-tools/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F3099%2Fduolingo-leaderboards). Opening a form does not execute a tool.