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
Scheduling Database Schema for Concurrent Bookings
00:00
5 left

Scheduling Database Schema for Concurrent Bookings

HardSQL · PostgreSQL

Problem

Design a relational database schema for a scheduling platform at Honor, ensuring data consistency and handling concurrent booking requests.

Define entities, relationships, constraints, and a transaction-safe booking approach. Then write a PostgreSQL query that evaluates pending requests against confirmed bookings and higher-priority pending requests.

Output

  1. One row per pending booking request.
  2. Columns: request_id, client_name, caregiver_name, queue_position, confirmed_conflicts, earlier_pending_conflicts, booking_status.
  3. Include all pending requests, ordered by caregiver_name, queue_position, and request_id.

Schema

caregivers
ColumnTypeDescription
caregiver_idPKBIGINTUnique caregiver identifier
caregiver_nameVARCHAR(120)Caregiver display name
timezoneVARCHAR(64)IANA timezone used for scheduling
clients
ColumnTypeDescription
client_idPKBIGINTUnique client identifier
client_nameVARCHAR(120)Client display name
care_planVARCHAR(80)Optional care plan label
booking_requests
ColumnTypeDescription
request_idPKBIGINTUnique booking request identifier
client_idBIGINTRequested client
caregiver_idBIGINTRequested caregiver
start_atTIMESTAMPTZRequested start timestamp
end_atTIMESTAMPTZRequested end timestamp
priorityINTHigher values receive precedence
created_atTIMESTAMPTZRequest creation time
statusVARCHAR(20)Request lifecycle status
bookings
ColumnTypeDescription
booking_idPKBIGINTUnique finalized booking identifier
request_idBIGINTOriginating request
client_idBIGINTBooked client
caregiver_idBIGINTBooked caregiver
start_atTIMESTAMPTZBooking start timestamp
end_atTIMESTAMPTZBooking end timestamp
statusVARCHAR(20)Booking lifecycle status
Tablescaregiversclientsbooking_requestsbookings
Interviewer

Your question is Scheduling Database Schema for Concurrent Bookings. 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.