Skip to main content
Datainteg
Career OS
Roadmaps
Practice
Resources
Community
Blog
Pricing
About
Login
Start Free
SQL Round Interview Questions · Datainteg · Datainteg Career OS
Interview Prep
Rounds
SQL Round
SQL Round Interview Questions
SQL round testing query writing, joins, aggregations, and optimization.
34 questions
Open in question bank
SQL Round questions
Write a query using `LIMIT` and `OFFSET` for pagination, and explain the performance problem with large offsets.
Intermediate
· sql query
premium
Write a MySQL upsert using `INSERT ... ON DUPLICATE KEY UPDATE`.
Intermediate
· sql query
premium
Write a query using Oracle's `ROWNUM` to return the first 10 rows, and explain the pitfall with `ROWNUM` and `ORDER BY`.
Intermediate
· sql query
premium
Write a hierarchical query using `CONNECT BY PRIOR` to traverse an org chart.
Intermediate
· sql query
premium
Write a `MERGE` statement to upsert data in Oracle.
Intermediate
· sql query
premium
Write a query to extract a nested field from a JSONB column and filter on it.
Intermediate
· sql query
premium
Write a query using `TOP` with `WITH TIES` to return the highest-paid employees including ties.
Beginner
· sql query
premium
Write a T-SQL `MERGE` statement to perform an upsert.
Intermediate
· sql query
premium
Write a query to list every customer and their order count, including customers with zero orders.
Beginner
· sql query
premium
Write a self-join query to find all employees who earn more than their manager.
Intermediate
· sql query
premium
Write a query to count the number of orders per customer.
Beginner
· sql query
premium
Write a query to find departments where the average salary exceeds 50,000.
Intermediate
· sql query
premium
Write a query to return the second highest salary from an `employees` table.
Intermediate
· sql query
premium
Write a query to return the Nth highest salary using a window function.
Intermediate
· sql query
premium
Write a query to compute a running total of daily sales using `SUM() OVER (...)`.
Intermediate
· sql query
premium
Write a query to find the top 3 products by sales within each category (per-group top-N).
Advanced
· sql query
premium
Write a query to find duplicate email addresses in a `users` table.
Intermediate
· sql query
premium
Write a query using `LAG()` to compute each month's sales change versus the previous month.
Intermediate
· sql query
premium
Write a query using a `CASE` expression to bucket customers into spend tiers (e.g., low/medium/high).
Intermediate
· sql query
premium
Write a recursive CTE to return the full management chain (all managers above) of a given employee.
Advanced
· sql query
premium
Write a query to pivot rows into columns (e.g., total sales per month as separate columns) using `CASE` with aggregation.
Advanced
· sql query
premium
Write an upsert in SQLite using `INSERT ... ON CONFLICT DO UPDATE`.
Intermediate
· sql query
premium
Write the MERGE/UPSERT logic to implement an SCD Type 2 load that closes the current row and inserts a new version when an attribute changes.
Advanced
· sql query
premium
Write a query that reports the null percentage and duplicate count for the primary-key column of a table.
Intermediate
· sql query
premium
Write a query that finds duplicate business keys that should be unique and returns the conflicting rows.
Advanced
· sql query
premium
Write a MERGE (upsert) statement that inserts new rows and updates changed rows from a staging table into a target table by primary key.
Intermediate
· sql query
premium
Write a query that selects only rows changed since the last high-water mark value passed as a parameter.
Advanced
· sql query
premium
Write a Delta `MERGE` statement that inserts new rows and updates matched rows from a source into a target.
Intermediate
· sql query
premium
Write a `COPY INTO` statement that loads Parquet files from an external S3 stage into a target table.
Intermediate
· sql query
premium
Use Spark SQL with DataFrames.
Intermediate
· sql query
premium
Browse all 34 SQL Round questions