Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
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 feedbackSuccess 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
Data Clearing and Modeling
00:00
5 left

Data Clearing and Modeling

HardSQL · PostgreSQL

Problem

Explain how you would approach data clearing and modeling for a reality-based problem scenario.

Using the provided tables, write a PostgreSQL query that excludes invalid records, resolves related creator and event information, and summarizes valid activity. Treat records with missing required identifiers or timestamps, negative watch time, inactive event types, or unmatched references as invalid. Do not exclude valid events solely because watch time is NULL.

Output

  1. One row per creator and active event category.
  2. Return creator_id, creator_name, event_category, event_count, total_watch_seconds, and category_rank.
  3. Rank categories within each creator by total watch time descending, with ties sharing a rank. Sort by creator_id, category_rank, and event_category.

Schema

creators
ColumnTypeDescription
creator_idPKINTUnique creator identifier
creator_nameVARCHAR(100)Creator display name
event_types
ColumnTypeDescription
event_type_idPKINTUnique event type identifier
event_nameVARCHAR(50)Raw event name
event_categoryVARCHAR(50)Normalized event category
is_activeBOOLEANWhether the event type is currently valid
raw_reality_events
ColumnTypeDescription
event_idPKINTUnique raw event identifier
creator_idINTReferenced creator identifier
event_type_idINTReferenced event type identifier
event_tsTIMESTAMPTimestamp when the event occurred
watch_secondsINTObserved watch duration in seconds
Tablesraw_reality_eventscreatorsevent_types
Interviewer

Your question is Data Clearing and Modeling. 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.