Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Trending in AI
Hot
Agentic AI EngineerForward-Deployed EngineerGenAI EngineerAI Architect
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
ExperiencesCoaching
New
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
Start free
Debugging a Timestamp Column
00:00
5 left

Debugging a Timestamp Column

MediumSQL · PostgreSQL

Problem

Given this dataframe, explore the timestamp column and explain what needs change.

Use the timestamp_events table to identify missing, malformed, date-only, timezone-free, and properly timezone-qualified values. Return the original value, its classification, a normalized timestamp where possible, and the recommended change.

Output

  1. One row per event, ordered by event_id.
  2. Columns: event_id, raw_timestamp, timestamp_status, normalized_timestamp, recommended_change.
  3. Preserve unparseable values as NULL in normalized_timestamp.

Output details

  • Classify NULL as missing, empty strings as empty, exact ISO timestamps with timezone as iso_with_timezone, timezone-free timestamps as timezone_missing, dates as date_only, and everything else as malformed.
  • Recognize only YYYY-MM-DDTHH:MM:SSZ or numeric-offset timestamps, YYYY-MM-DDTHH:MM:SS, and YYYY-MM-DD; do not accept fractional seconds or other separators.
  • Assume UTC when normalizing timezone-free timestamps and date-only values.
  • Return the exact status-specific recommendation strings used by the reference, including No change required for iso_with_timezone.

Schema

timestamp_events
ColumnTypeDescription
event_idPKINTUnique event identifier
source_systemVARCHAR(50)System that supplied the event
raw_timestampVARCHAR(50)Timestamp value as received from the source
Tablestimestamp_events
Interviewer

Whenever you're ready, walk me through your approach or go straight to the code. The requirements and the one table are in the Question tab.

Sign up free to run or submit. Log in
CodePostgreSQL
Sign up free to run your code. Your draft is saved.Run with a free accountLog inLn 1
Run your query to see results here.