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
Building Scalable Models with dbt
00:00
5 left

Building Scalable Models with dbt

MediumSQL · PostgreSQL

Problem

Describe a time you used dbt or similar transformation tools to build a scalable data model.

For the hands-on portion, write a PostgreSQL transformation query that produces a reusable monthly usage model from the provided source tables. Include only completed events, preserve valid events with missing service records, and make the output suitable for downstream analytics.

Output

  1. One row per account, calendar month, and service.
  2. Return account_id, account_name, usage_month, service_name, service_tier, completed_gpu_hours, completed_cost, and event_count.
  3. Sort by account_id, usage_month, and service_name, with missing service names last.

Schema

usage_events
ColumnTypeDescription
event_idPKINTUnique usage event identifier
account_idINTAccount associated with the event
service_idINTService associated with the event
usage_timestampTIMESTAMPTime when usage occurred
gpu_hoursNUMERIC(10,2)GPU hours recorded for the event
costNUMERIC(12,2)Cost associated with the event
statusVARCHAR(20)Event processing status
accounts
ColumnTypeDescription
account_idPKINTUnique account identifier
account_nameVARCHAR(100)Account display name
regionVARCHAR(30)Account region
services
ColumnTypeDescription
service_idPKINTUnique service identifier
service_nameVARCHAR(100)Service display name
service_typeVARCHAR(30)Service classification
Tablesusage_eventsaccountsservices
Interviewer

Your question is Building Scalable Models with dbt. 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.