AnalystPath

Distinct Languages Spoken by Each Guide

SQLEasyJunior level~15 min

Problem

A travel agency records which languages each tour guide offers and in which region. Table `guide_languages` has columns `(guide_id, language_id, region_id)`, and the pair `(language_id, region_id)` is unique. A single row means the guide offers that language in that region, so the same guide can appear with the same language across several regions.

Count how many distinct languages each guide offers across all regions.

Return the columns `guide_id` and `language_count`, in any order.

Tables

Example rows — the live problem includes the full dataset.

guide_languages
guide_idlanguage_idregion_id
123
124
133

Expected output

Your answer should return 2 rows with the columns guide_id, language_count.

Starter code (SQL)

SELECT *
FROM guide_languages;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions