InterviewStack.io LogoInterviewStack.io

String and Date Manipulation Questions

Covers practical skills for manipulating textual and temporal data. Typical expectations include string operations such as concatenation, substring extraction, case transformation, pattern replacement, and trimming, as well as date and time operations such as truncation, extracting date parts, computing differences, adding intervals, formatting, and handling time zones and daylight saving edge cases. Candidates may be asked to write or explain queries and small code snippets, reason about correctness and performance, and discuss pitfalls such as locale formats, leap seconds, and ambiguous input.

HardTechnical
86 practiced
During the fall DST transition (clocks go back), some timestamps are ambiguous (e.g., '2023-11-05 01:30' occurs twice in 'America/New_York'). As a BI engineer, describe how you'd detect, store, and disambiguate such events so reporting doesn't double-count or misorder events. Include storage recommendations and any data model changes.
EasyTechnical
100 practiced
You have an `events` table with columns: (event_id INT, event_ts TIMESTAMP WITH TIME ZONE). Write a PostgreSQL query that returns event_id plus extracted fields: event_date (date), year, month, day, hour, and ISO week number for each timestamp. Show how EXTRACT, DATE_PART and DATE_TRUNC differ and when you'd use each for BI aggregations.
MediumTechnical
105 practiced
Customer names may include Unicode variants (accents, ligatures). Describe how you would normalize names to a canonical form for deduplication using Python (e.g., NFKC/NFKD), and discuss performance and correctness concerns when running this at scale on millions of rows.
EasyTechnical
86 practiced
As a BI analyst you must normalize email addresses stored in `users.email` before deduplication. In SQL (choose Postgres or BigQuery) write an expression that: trims whitespace, lowercases the value, replaces any non-breaking spaces, and removes trailing dots before the domain. Provide a sample input and expected normalized output.
MediumTechnical
86 practiced
Describe efficient ways to implement case-insensitive joins on large string columns (e.g., joining `users.email` to `events.actor_email`) in a data warehouse. Provide SQL examples for at least one DB (Postgres or Snowflake) and discuss indexes/collations/functional indexes or hash keys.

Unlock Full Question Bank

Get access to hundreds of String and Date Manipulation interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.