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.
Implement a discount or promotion rule as deterministic, testable logic: for example, a line item qualifies for a discount only when several conditions all hold (a flag on the customer, a threshold on the order total, and a lookback window with no qualifying event). When multiple promotions could apply to the same item, the best discount should win. Provide an implementation (SQL or pseudocode) and describe how you would unit-test the rule set, including its edge cases.
Given an events table, write a SQL query that computes weekly (or daily) active users per cohort or per entity, correctly deduplicating multiple events from the same user within the same period, and excluding invalid or null identifiers. Then extend it to a retention calculation: for each signup cohort, what percentage of users from that cohort are still active N periods later.
You receive phone numbers from several partners in inconsistent formats (with or without country codes, extensions, punctuation, or leading zeros). Design a normalization and validation workflow that produces a single canonical format suitable for matching and analytics, including how you would flag numbers you cannot confidently normalize and any privacy considerations for storing them.
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.
Explain how NULL participates in SQL comparisons, joins, and aggregations, contrasting it with an empty string and with zero. Describe three common pitfalls this causes when joining or aggregating real data, and the standard techniques (COALESCE, explicit NULL checks, filtering) used to handle each.
Unlock Full Question Bank
Get access to all 25 Data Transformation and Processing Logic interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.