Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Top LEGO Themes in EMEA
00:00
5 left

Top LEGO Themes in EMEA

MediumSQL · PostgreSQL

Problem

Write a SQL query to find the top three best-selling LEGO themes in the EMEA region for the last quarter.

Assume the last quarter is from 2025-04-01 through 2025-06-30, inclusive. Best-selling means the highest total number of units sold.

Output

  1. Return one row per selected LEGO theme.
  2. Include theme_name and total_units_sold.
  3. Return exactly three rows, ordered by total_units_sold descending, with theme_name ascending as the tie-breaker.

Schema

lego_sales
ColumnTypeDescription
sale_idPKINTUnique sales record identifier
theme_idINTLEGO theme associated with the sale
region_idINTSales region associated with the sale
sale_dateDATEDate on which the units were sold
units_soldINTNumber of LEGO units sold
lego_themes
ColumnTypeDescription
theme_idPKINTUnique LEGO theme identifier
theme_nameVARCHAR(100)LEGO theme name
sales_regions
ColumnTypeDescription
region_idPKINTUnique sales region identifier
region_codeVARCHAR(20)Short code for the sales region
region_nameVARCHAR(100)Full sales region name
Tableslego_saleslego_themessales_regions
Interviewer

Your question is Top LEGO Themes in EMEA. Start with the requirements and the three tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.