sql
AI, ML & GenAI interview questions tagged sql, across every topic.
39 questions · 3 unlocked for you
Concepts behind "sql"
The curriculum that explains the ideas these questions test.
Foundational
Window FunctionsWindow functions run calculations over a set of rows tied to the current row, without collapsing them the way GROUP BY does, so you can rank within groups, build running totals and moving averages, and compare a row against its neighbors (LAG/LEAD), all in a single pass. They anchor analytics SQL: top-N-per-group, sessionization, cohort analysis, and period-over-period. AI, ML, and GenAI interviews probe them because they are the single most-tested SQL skill and the clearest way to write analytical queries.🗄️ Data & SQL Engineering
Foundational
Data Quality and ContractsModels and analytics are only as good as the data behind them, and a silent upstream data change (a renamed column, a units switch, a spike in nulls) corrupts everything downstream without raising an error. Data quality means automated checks (schema, ranges, nulls, freshness, volume, uniqueness) plus data contracts between producers and consumers enforced in CI. AI, ML, and GenAI interviews probe it because 'garbage in, garbage out' is the most common and hardest-to-diagnose cause of model and dashboard failures.🗄️ Data & SQL Engineering
Foundational
SQL JoinsJoins combine rows across tables on a matching condition, and the join type (inner, left, right, full, semi, anti) decides which non-matching rows survive. AI, ML, and GenAI interviews probe joins because they are the single most error-prone SQL construct: the wrong type quietly drops or duplicates rows, and a non-unique join key fans out your row count without raising an error.🗄️ Data & SQL Engineering
Foundational
GROUP BY and AggregationGROUP BY collapses rows that share the same key values into one row per group, and aggregate functions (COUNT, SUM, AVG) produce a single value per group. AI, ML, and GenAI interviews probe it because the semantics trip people up: a column must be either grouped or aggregated, COUNT quietly skips NULLs, and HAVING filters groups while WHERE filters rows. Conditional aggregation with SUM of CASE is the move that pivots data without a join.🗄️ Data & SQL Engineering
Foundational
CTEs and SubqueriesA CTE (the WITH clause) names an intermediate result so a query reads as a top-to-bottom pipeline rather than nested subqueries. The skill is knowing when a subquery should be correlated versus uncorrelated, when a recursive CTE is the right tool for hierarchies and graphs, and when a CTE acts as an optimization fence that blocks the planner. AI, ML, and GenAI interviews probe it because refactoring a tangled nested query into a readable, correct pipeline is a daily data-engineering task.🗄️ Data & SQL Engineering
Core
Transactions, ACID, and Isolation LevelsA transaction bundles multiple reads and writes so the whole set either commits together or rolls back together, backed by the ACID guarantees of atomicity, consistency, isolation, and durability. The isolation level is the knob that balances concurrency anomalies (dirty reads, non-repeatable reads, phantoms) against throughput, and most databases ship with a weaker default than engineers expect. AI, ML, and data interviews probe it because pipelines that overlook isolation yield silent, intermittent corruption that no unit test will catch.🗄️ Data & SQL EngineeringSign in
