SQL Dialects and Built-in Functions Questions
Portability and idiom differences across SQL engines (PostgreSQL, Redshift, MySQL, SQL Server, and others), plus fluent use of built-in string, date/time, and type-conversion functions. Covers dialect-specific syntax, function availability, and writing queries that behave predictably across platforms. Relevant when candidates move between database ecosystems.
Multiple source systems provide date fields in inconsistent formats and locales (e.g., '03/04/2024' meaning March 4 in one system but April 3 in another, plus epoch integers). Design a robust automated cleaning pipeline to detect locales and normalize dates to ISO 8601 UTC timestamps. Include detection heuristics, fallback rules, logging, and how you'd handle ambiguous values.
Design a monitoring and alerting system for date-partitioned ETL jobs that detects missing or stale daily partitions (e.g., yesterday's partition not loaded) and triggers retries and stakeholder notifications. Describe metrics to track (data freshness, job runtime, success rate), recommended alert thresholds, and how to avoid alert fatigue.
Write an SQL query using a regular expression to select email addresses from customers(email) that end with '.co.uk' or '.com' but exclude any that have invalid characters according to a simplified regex. Use PostgreSQL syntax (e.g., ~* for case-insensitive regex). Discuss portability to MySQL and SQL Server.
Describe a robust SQL expression (Postgres or BigQuery) to compute a person's age in years from a birth_date column that handles leap years and returns correct integer ages (i.e., age increments only after the birthday has passed in the current year). Explain why simple /365 approaches are incorrect and provide an example edge case.
You need a 14-day moving average in Tableau for a KPI. Explain how you would implement this with table calculations, how LOD expressions might interact with that, and describe common pitfalls when mixing LOD and table calculations. Provide steps to ensure the moving average respects the visualization's dimensions and filters.
Unlock Full Question Bank
Get access to all SQL Dialects and Built-in Functions interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.