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
Weekly Restaurant Performance SQL
00:00
5 left

Weekly Restaurant Performance SQL

MediumSQL · PostgreSQL

Problem

Write a SQL query to analyze weekly restaurant performance by location, including sales, labor cost, and food waste trends.

Use the provided Famous Dave's location, sales, labor, and food-waste data. Return one row for each location and week with available operational data, including week-over-week percentage changes. Treat missing measures as zero for the current week, and return NULL for a percentage change when the prior value is zero or unavailable.

Output

  1. Columns: location_name, week_start, sales, labor_cost, food_waste, prior_sales, sales_change_pct, labor_change_pct, waste_change_pct
  2. One row per location and Monday-based week
  3. Order by location_name, then week_start ascending

Schema

restaurant_locations
ColumnTypeDescription
location_idPKINTUnique restaurant location identifier
location_nameVARCHAR(100)Famous Dave's restaurant location name
restaurant_sales
ColumnTypeDescription
sale_idPKINTUnique sales record identifier
location_idINTRestaurant location associated with the sale
sale_dateDATEDate of the sales record
sales_amountNUMERIC(12,2)Sales amount recorded for the date
restaurant_labor
ColumnTypeDescription
labor_idPKINTUnique labor record identifier
location_idINTRestaurant location associated with labor cost
labor_dateDATEDate of the labor cost record
labor_costNUMERIC(12,2)Labor cost recorded for the date
food_waste
ColumnTypeDescription
waste_idPKINTUnique food waste record identifier
location_idINTRestaurant location associated with food waste
waste_dateDATEDate of the food waste record
waste_costNUMERIC(12,2)Estimated cost of wasted food
Tablesrestaurant_locationsrestaurant_salesrestaurant_laborfood_waste
Interviewer

Your question is Weekly Restaurant Performance SQL. Start with the requirements and the four 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.