Data Transformation and Processing Logic Questions

Implementing transformation logic: joins, aggregations, deduplication, pivoting/reshaping, and business-rule application over datasets. Covers writing correct and maintainable transformation code, handling edge cases in the transform layer, and preparing data for downstream consumption. Focuses on the logic of turning raw data into analytics-ready outputs.

HardTechnical
41 practiced

Implement a loyalty-points business rule in SQL: a purchase earns points, but if the customer returns an item within the same calendar month as the purchase, the points for that item must be revoked; if the return happens after the month boundary, the points remain pending until manual verification instead of being revoked automatically. Handle partial returns by quantity and orders with multiple line items, and produce net points per user per month.

MediumTechnical
34 practiced

You receive timestamps in several inconsistent formats and time zones from different sources (for example '2024-01-02 13:00', '01/02/2024 1pm PST', an epoch value, or a date string with an ambiguous day/month order). Design a robust approach to parse and normalize all of these into timezone-aware UTC timestamps. Discuss how you detect and handle ambiguous dates (02/03/2024), missing timezone information, and DST transitions, and how you would detect signs of clock skew or duplicated timestamps between sources before trusting the normalized result.

MediumTechnical
41 practiced

A table stores raw event data as a JSON field containing nested objects and arrays (for example a user object and a products array). Write a SQL query that extracts the nested scalar fields into named columns and un-nests (explodes) the array into one row per array element, producing a flat, analysis-ready table. Discuss the trade-off between flattening at ingestion time (fixed schema, faster queries) versus parsing the JSON at query time (flexible, slower) as new nested fields appear.

MediumTechnical
28 practiced

You're setting up a new dbt project for a company's first analytics-engineering effort. How would you lay out staging, intermediate, and mart models, and how do you decide per-model whether it should materialize as incremental or full-refresh?

MediumTechnical
37 practiced

Given a table of sales by date and product category, write a SQL query that pivots the category values into columns, showing monthly revenue per category for the last several months. Handle categories with no sales in a given month (NULL versus zero) and discuss what you would change to make the query portable across SQL dialects.

Unlock Full Question Bank

Get access to all 25 Data Transformation and Processing Logic interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.