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
Identifying Power Users with SQL
00:00
5 left

Identifying Power Users with SQL

MediumSQL · PostgreSQL

Problem

How would you identify power users in our database using complex joins and aggregations at Delivery Hero?

Treat a power user as a customer with at least three completed orders, at least 100 in total completed order value, and orders from at least two restaurants during Q1 2025.

Output

  1. Return one row per qualifying customer with user_id, user_name, city, completed_orders, total_spend, and restaurants_used.
  2. Exclude customers who do not meet all three criteria.
  3. Order by total_spend descending, then completed_orders descending, then user_name ascending.

Schema

users
ColumnTypeDescription
user_idPKINTUnique Delivery Hero customer identifier
user_nameVARCHAR(100)Customer display name
cityVARCHAR(80)Customer city
orders
ColumnTypeDescription
order_idPKINTUnique order identifier
user_idINTCustomer who placed the order
restaurant_idINTRestaurant associated with the order
statusVARCHAR(20)Order lifecycle status
order_dateDATEDate the order was placed
total_amountNUMERIC(10,2)Total order value
restaurants
ColumnTypeDescription
restaurant_idPKINTUnique restaurant identifier
restaurant_nameVARCHAR(120)Restaurant name
cityVARCHAR(80)Restaurant city
Tablesusersordersrestaurants
Interviewer

Your question is Identifying Power Users with SQL. 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.