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
Analyze Outlet Sales by Region
00:00
5 left

Analyze Outlet Sales by Region

MediumSQL · PostgreSQL

Problem

You are given sales activity from Coca-Cola Consolidated outlets and asked to turn it into actionable insight. Write a PostgreSQL query that returns, for each region and month in Q1 2024, the total revenue, total units sold, number of active outlets with at least one completed sale, and an insight label showing whether the region is Growing, Declining, or Flat compared with the prior month based on revenue. Only include completed sales in the analysis.

Schema

ccc_regions
ColumnTypeDescription
region_idPKINTUnique region identifier
region_nameVARCHAR(50)Coca-Cola Consolidated region name
ccc_outlets
ColumnTypeDescription
outlet_idPKINTUnique outlet identifier
outlet_nameVARCHAR(100)Outlet name
region_idINTRegion assigned to the outlet
outlet_typeVARCHAR(30)Outlet channel type
opened_dateDATEOutlet opening date
ccc_sales
ColumnTypeDescription
sale_idPKINTUnique sale identifier
outlet_idINTOutlet where the sale occurred
sale_dateDATEDate of sale
units_soldINTCases sold
revenueDECIMAL(10,2)Revenue from the sale
sale_statusVARCHAR(20)Sale status
Tablesccc_regionsccc_outletsccc_sales
Interviewer

Your question is Analyze Outlet Sales by Region. 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.