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
SQL for Complaint Driver Analysis
00:00
5 left

SQL for Complaint Driver Analysis

HardSQL · PostgreSQL

Problem

Write a SQL query to analyze daily guest complaints by property, category, and week at Caesars entertainment, and identify the top drivers of repeat complaints.

Use all available complaint records. A complaint is repeat when the same guest has previously complained at the same property and category. Treat Monday as the beginning of each week.

Output

  1. One row per property, category, week, and complaint date.
  2. Include property_name, category_name, week_start, complaint_date, daily_complaint_count, daily_repeat_count, weekly_repeat_count, and driver_rank.
  3. Include all categories with complaints, order by property, week, category, and date, and assign tied drivers the same rank.

Schema

properties
ColumnTypeDescription
property_idPKINTProperty identifier
property_nameVARCHAR(100)Caesars Entertainment property name
cityVARCHAR(80)Property city
guests
ColumnTypeDescription
guest_idPKINTGuest identifier
guest_nameVARCHAR(120)Guest display name
complaint_categories
ColumnTypeDescription
category_idPKINTComplaint category identifier
category_nameVARCHAR(80)Complaint category
guest_complaints
ColumnTypeDescription
complaint_idPKINTComplaint identifier
guest_idINTGuest who submitted the complaint
property_idINTProperty receiving the complaint
category_idINTComplaint category
complaint_dateDATEDate the complaint was submitted
statusVARCHAR(30)Complaint resolution status
notesTEXTOptional complaint notes
Tablespropertiesguestscomplaint_categoriesguest_complaints
Interviewer

Your question is SQL for Complaint Driver Analysis. 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.