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
High-Throughput Write Schema Design
00:00
5 left

High-Throughput Write Schema Design

MediumSQL · PostgreSQL

Problem

How do you design a database schema that supports high-throughput write operations while maintaining data integrity for Press Ganey?

For this SQL exercise, use the supplied schema to identify the latest represented ingestion batch for each organization and assess its event and answer coverage.

Output

  1. Return one row per organization with at least one represented batch.
  2. Include organization_code, batch_id, received_at, event counts, answer coverage percentage, and the prior batch event count.
  3. Sort by received_at descending, then organization_code ascending. Rows with a NULL received_at are ignored.

Schema

organizations
ColumnTypeDescription
organization_idPKUUIDStable organization identifier
organization_codeVARCHAR(40)Organization code
created_atTIMESTAMPTZOrganization creation timestamp
ingestion_batches
ColumnTypeDescription
batch_idPKUUIDIngestion batch identifier
source_systemVARCHAR(40)Source system name
received_atTIMESTAMPTZBatch receipt timestamp
row_countINTEGERRows received in the batch
survey_events
ColumnTypeDescription
event_idPKUUIDSurvey event identifier
event_received_atTIMESTAMPTZEvent ingestion timestamp
organization_idUUIDOwning organization
batch_idUUIDSource ingestion batch
source_record_numberINTEGERRecord position within the source batch
occurred_atTIMESTAMPTZEvent occurrence timestamp
event_typeSMALLINTEvent type code
payloadJSONBOriginal event payload
event_answers
ColumnTypeDescription
answer_idPKBIGINTAnswer identifier
event_idUUIDRelated survey event
question_codeVARCHAR(40)Survey question code
answer_valueVARCHAR(200)Submitted answer value
recorded_atTIMESTAMPTZAnswer recording timestamp
Tablesorganizationsingestion_batchessurvey_eventsevent_answers
Interviewer

Your question is High-Throughput Write Schema Design. 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.