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
Data Manipulation Gotchas
00:00
5 left

Data Manipulation Gotchas

MediumSQL · PostgreSQL

Problem

Tell me about a time you handled tricky data manipulation issues, including edge cases and unexpected input, in a production system.

For a hands-on SQL follow-up, use the users and production_events tables. Treat supported event types as valid only when their timestamp is present and their value is either nonnegative or NULL.

Output

  1. One row per user, including users with no events
  2. Columns: user_id, email, valid_event_count, anomaly_count, and latest_valid_at
  3. Exclude unknown users from the result, count invalid known-user events as anomalies, and sort by user_id ascending

Schema

users
ColumnTypeDescription
user_idPKINTUnique identifier for a known user
emailVARCHAR(255)User email address
external_keyVARCHAR(64)Optional identifier from an external system
production_events
ColumnTypeDescription
event_idPKINTUnique production event identifier
user_idINTUser associated with the event, when known
event_typeVARCHAR(64)Reported event type
occurred_atTIMESTAMPTime at which the event occurred
valueDECIMAL(10,2)Optional nonnegative event value
sourceVARCHAR(32)Originating ingestion source
Tablesusersproduction_events
Interviewer

Your question is Data Manipulation Gotchas. Start with the requirements and the two 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.