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
Star Schema for Device Telemetry
00:00
5 left

Star Schema for Device Telemetry

HardSQL · PostgreSQL

Problem

Design a dimensional star schema to track global device telemetry and recurring subscription lifecycle events at Apple.

Represent the design with device and subscription dimensions plus a combined event fact table. Write a query that summarizes January 2025 telemetry for subscriptions whose latest lifecycle status is available by the end of that month.

Output

  1. One row per region, device type, and subscription tier
  2. Columns: region, device_type, subscription_tier, active_subscriptions, telemetry_event_count, and avg_cpu_percent
  3. Include canceled subscriptions when telemetry exists, with zero active subscriptions
  4. Sort by region, device_type, and subscription_tier ascending

Schema

dim_device
ColumnTypeDescription
device_idPKINTSurrogate key for the device dimension
device_typeVARCHAR(50)Apple device category
regionVARCHAR(50)Device operating region
dim_subscription
ColumnTypeDescription
subscription_idPKINTSurrogate key for the subscription
subscription_tierVARCHAR(80)Apple subscription product or tier
fact_device_subscription_event
ColumnTypeDescription
event_idPKINTUnique telemetry or lifecycle event identifier
device_idINTReferenced device dimension key
subscription_idINTReferenced subscription dimension key
event_typeVARCHAR(30)Telemetry or subscription lifecycle event type
event_statusVARCHAR(30)Lifecycle status represented by the event
event_tsTIMESTAMPUTC timestamp when the event occurred
cpu_percentDECIMAL(5,2)CPU utilization captured by a telemetry event
Tablesdim_devicedim_subscriptionfact_device_subscription_event
Interviewer

Your question is Star Schema for Device Telemetry. 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.