What can you learn from 612 real SQL interviews?

Joins, indexes and slow queries came up more than anything else. Here is what to prepare first, where real answers fell apart, and which queries to practise writing.

Which SQL questions should you prepare first?

Query optimization and indexing came up in 31% of these interviews, joins and aggregation in 22%, and SQL basics in 21%. The questions asked most often:

  • Which rows do INNER, LEFT, RIGHT and FULL OUTER JOIN return? Asked in 46 interviews.
  • How do indexes work, and when are they worth the cost? Asked in 32.
  • How would you find and fix a slow query? Asked in 31.
  • How do WHERE and HAVING differ? Can you use both in one query? Asked in 23.

Where do real answers fall apart?

We read the reviews of 627 real answers to key questions. These gaps came up again and again.

Joins: knowing the names, not the result. Almost everyone could list INNER, LEFT, RIGHT and FULL OUTER JOIN. The trouble came when they had to say exactly which rows come back. In 11 of the 24 reviewed answers to the basic joins question, the candidate was unclear about rows with no match: where the NULLs appear, or what FULL OUTER JOIN keeps. Check yourself: draw two small tables with three rows each, and write the result of each join by hand.

Indexes: only half of the answer. Most answers said an index makes reads faster, and stopped there. The missing half was the cost, slower inserts, updates and deletes (8 of 21 reviewed answers), or the types of index, such as clustered and non-clustered (6 of 21). This is also what interviewers asked next: in these interviews, a question about indexes was often followed by one about their downsides. Check yourself: can you name the cost of an index, and say when you would not add one?

WHERE and HAVING: the order, but not the reason. Most candidates knew that WHERE filters before grouping and HAVING after it. What 6 of the 11 reviewed answers missed is why HAVING exists: WHERE cannot filter on COUNT(), SUM() or other aggregates. Check yourself: can you explain why WHERE COUNT(*) > 5 fails, but HAVING COUNT(*) > 5 works?

Not being able to write the query. In 45 reviewed answers to "write a query" tasks, the query was never finished or did not work. About half of them (22) were basic statements: an UPDATE, changing a column type with ALTER TABLE, joining two tables, a filter with BETWEEN, replacing NULL with 0, a CASE WHEN. Most of the rest (16) were ranking tasks, like the second-highest salary or the latest record for each user: candidates often named the right tool, such as ROW_NUMBER or DENSE_RANK, but could not complete the query. Check yourself: can you write these from memory, without autocomplete?

What does a weak and a strong answer sound like?

Which rows do INNER, LEFT and FULL OUTER JOIN return?

Weak answer: "INNER JOIN returns the matching rows, LEFT JOIN returns all rows from the left table, and FULL OUTER JOIN returns everything."

Stronger answer: "INNER JOIN returns only rows that have a match in both tables. LEFT JOIN returns every row from the left table; when there is no match, the right table's columns are NULL. If one left row matches three right rows, it appears three times. FULL OUTER JOIN returns all rows from both tables, with NULLs on whichever side has no match."

What is an index, and when is it worth it?

Weak answer: "An index makes queries faster."

Stronger answer: "An index is a separate structure, usually a B-tree, that lets the database find rows without scanning the whole table. It speeds up queries that filter, join or sort on the indexed columns. The cost is that every insert, update and delete also has to update the index, and the index takes space. So I add indexes for frequent queries on large tables, not on every column."

Which queries should you practise writing?

In this sample, 105 of the 612 interviews (17%) had a query-writing task. These came up most:

  • Find the second-highest distinct salary: 13 interviews. Check: what does your query return when two people share the top salary, or when there is only one salary?
  • Find the highest-paid employee in each department: 7. Check: what happens with a tie?
  • Delete duplicate rows but keep one copy: 4.
  • Find the latest record for each user: 3.
  • Join Users and Orders and count orders: 2. Check: do users with no orders still show up, with zero orders?

What should you focus on for your role?

  • Backend: transactions and concurrency came up in 36% of interviews for this role, against 19% overall.
  • Data engineering: advanced SQL in 38%, joins and aggregation in 37%.
  • Full-stack: optimization and indexing in 43%.
  • Data analysis: joins and aggregation in 51%, advanced SQL in 33%.

Who gets asked SQL

Backend developer223 interviews
Data engineer91 interviews
Data analyst43 interviews
ERP / CRM developer24 interviews
AI engineer23 interviews

The 20 most asked SQL questions

Counted by interview, not by mention: a question asked twice in one conversation counts once.

  1. What are SQL joins, and which rows do INNER, LEFT, RIGHT, and FULL OUTER JOIN return?

    Asked in 46 of 612 interviews · last asked Oct 22 · Concept · Junior

    Show answer

    SQL joins combine rows from two tables using a match condition. INNER JOIN returns only matching row pairs. LEFT and RIGHT JOIN return matches plus every unmatched row from the left or right table, respectively, with NULLs for the missing side. FULL OUTER JOIN returns matches and unmatched rows from both tables, with NULLs for the missing side.

    • The join condition, usually written with ON, determines which row pairs match.
    • LEFT preserves every left-side row; RIGHT preserves every right-side row.
    • A row with multiple matches appears once for each matching pair.
    • Support for RIGHT JOIN and FULL OUTER JOIN depends on the database and version.

    What the interviewer checks: The interviewer checks whether you understand matching rows, preserved rows, and NULLs for missing matches.

    Common mistake (in 10 of 25 reviewed answers): Many answers forget that LEFT and RIGHT JOIN keep every row from their preserved side, filling missing opposite-side columns with NULLs.

    Other ways it was asked
    • “What is the difference between an inner join and a left join?”
    • “What is the difference between INNER JOIN, LEFT JOIN, and FULL OUTER JOIN?”
    • “What types of joins are available in SQL?”
  2. What are database indexes, how do they work, and when do their benefits outweigh their costs?

    Asked in 32 of 612 interviews · last asked Oct 14 · Concept · Junior

    Show answer

    Database indexes are extra data structures that help find rows faster. A B-tree index keeps keys ordered, allowing searches for matches or ranges without scanning every row. Indexes need storage and maintenance on inserts, updates, and deletes. Their benefits outweigh their costs when frequent queries save more work than maintaining the indexes adds.

    • Index columns used often in filters, joins, and sorting.
    • A table scan can be cheaper for small tables or queries returning many rows.
    • Where supported, clustered indexes organize table data by key, helping range queries.
    • Non-clustered indexes provide separate lookup paths using keys and row references; exact storage details vary by database.

    What the interviewer checks: The interviewer checks whether you understand how indexes speed up queries and balance read benefits against write costs.

    Common mistake (in 7 of 17 reviewed answers): Many answers forget that indexes cost storage and slow writes, so choose them based on the read and write workload.

    Other ways it was asked
    • “What is indexing?”
    • “What is an index?”
    • “What are database indexes, and what are they used for?”
  3. How would you identify, investigate, and optimize slow SQL queries?

    Asked in 31 of 612 interviews · last asked Oct 20 · Scenario · Mid-level

    Show answer

    I find slow or costly queries using query logs and monitoring, then record their runtime and resource use. I inspect execution plans and runtime metrics to locate the bottleneck. Based on the cause, I add suitable indexes, update statistics, or rewrite the query. I rerun it under similar conditions and compare performance, while checking that results stay correct.

    • Prioritize queries by runtime, frequency, and total resource use.
    • Check plans for expensive scans, joins, sorts, and inaccurate row estimates; check waits for blocking.
    • Choose fixes based on evidence; extra indexes use space and slow writes.
    • Compare elapsed time, CPU, and reads before and after using representative parameters.

    What the interviewer checks: The interviewer checks whether you measure the problem, choose a targeted fix, and verify the improvement.

    Common mistake (in 6 of 12 reviewed answers): Many answers forget that execution plans and runtime metrics should guide the fix, rather than guessing.

    Other ways it was asked
    • “How would you optimize a slow SQL query?”
    • “What can you do to improve the performance of a slow SQL query?”
    • “How would you optimize slow database queries?”
  4. How do relational and NoSQL databases differ, and when would you choose one over the other?

    Asked in 25 of 612 interviews · last asked Oct 23 · Concept · Mid-level

    Show answer

    Relational databases, like SQL Server, store data in tables with defined schemas; NoSQL databases use document, key-value, or other models. MongoDB stores documents, often with flexible fields. Choose relational databases for joins, constraints, and transactions across related data. Choose NoSQL when its data model and scaling options fit your workload, while checking transaction and consistency support.

    • Relational databases can enforce relationships through foreign keys and combine related data through joins.
    • NoSQL schema flexibility varies; MongoDB can enforce document validation rules.
    • MongoDB supports transactions across documents; compare transaction scope, guarantees, and costs.
    • Both types can scale; choose based on access patterns, consistency needs, and operational complexity.

    What the interviewer checks: The interviewer checks whether you can choose a database based on data structure, relationships, and reliability needs.

    Common mistake (in 3 of 9 reviewed answers): Many answers forget that NoSQL includes several data models, so distinguish them rather than treating NoSQL as one design.

    Other ways it was asked
    • “What is the difference between SQL and NoSQL databases?”
    • “What is the key difference between SQL and NoSQL databases?”
    • “What is the main difference between a SQL and NoSQL database?”
  5. How do WHERE and HAVING differ, and can you use both in one query?

    Asked in 23 of 612 interviews · last asked Oct 15 · Concept · Junior

    Show answer

    WHERE filters individual rows before grouping and aggregation. HAVING filters groups after aggregation, so it can filter results such as COUNT or SUM. You can use both in one query: WHERE limits the input rows, and HAVING limits the resulting groups.

    • WHERE cannot directly filter aggregate results from the same query level.
    • HAVING can filter aggregate results, even when those results are not in SELECT.
    • With aggregation, HAVING can work without GROUP BY, treating the input as one group.
    SQL
    SELECT department_id, COUNT(*) AS employee_count
    FROM employees
    WHERE salary > 50000
    GROUP BY department_id
    HAVING COUNT(*) >= 5;

    What the interviewer checks: The interviewer is checking whether you understand row filtering, group filtering, and their logical order.

    Common mistake (in 5 of 10 reviewed answers): Many answers forget that WHERE filters rows before aggregation, while HAVING filters groups after aggregation.

    Other ways it was asked
    • “What is the difference between WHERE and HAVING?”
    • “What is the difference between WHERE and HAVING in SQL?”
    • “What is the difference between WHERE and HAVING, and when would you use each?”
  6. What are the ACID properties of database transactions?

    Asked in 15 of 612 interviews · last asked Oct 12 · Concept · Junior

    Show answer

    ACID stands for atomicity, consistency, isolation, and durability. Atomicity means all changes succeed or none do; consistency means transactions preserve database rules. Isolation controls how concurrent transactions affect each other, depending on the isolation level. Durability means committed changes survive a crash.

    • A transaction groups database operations into one unit of work.
    • Consistency depends on both database constraints and correct transaction logic.
    • Serializable isolation makes concurrent transactions behave as if they ran one at a time.
    Code
    To transfer money between two accounts:
    Begin a transaction.
    Subtract the amount from the source account.
    Add the same amount to the destination account.
    Commit if both steps succeed; otherwise roll back.

    What the interviewer checks: The interviewer checks whether you understand how transactions protect data during failures and concurrent work.

    Common mistake (in 4 of 6 reviewed answers): Many answers forget that all four properties need definitions, not just their names.

    Other ways it was asked
    • “What are the ACID properties in database transactions?”
    • “What does ACID mean in the context of databases?”
    • “What are ACID properties?”
  7. Write a SQL query to find the second-highest distinct salary.

    Asked in 13 of 612 interviews · last asked Oct 22 · Write code · Junior

    Show answer

    I find the highest salary below the maximum salary. This gives the second-highest distinct salary, so duplicates do not affect the result. A window function is another option. Both queries below ignore NULL salaries and return NULL if fewer than two distinct salaries exist.

    • Use a strict less-than comparison to exclude every occurrence of the highest salary.
    • DENSE_RANK gives equal salaries the same rank, without gaps.
    • ROW_NUMBER can count duplicate salaries separately and give the wrong result.
    SQL
    SELECT MAX(salary) AS second_highest_salary
    FROM employees
    WHERE salary < (SELECT MAX(salary) FROM employees);
    WITH ranked AS (
      SELECT salary, DENSE_RANK() OVER (ORDER BY salary DESC) AS salary_rank
      FROM employees
      WHERE salary IS NOT NULL
    )
    SELECT MAX(salary) AS second_highest_salary
    FROM ranked WHERE salary_rank = 2;

    What the interviewer checks: The interviewer checks whether you can find a distinct salary rank while handling duplicates and missing results.

    Other ways it was asked
    • “Write an SQL query to find the third-highest employee salary.”
    • “Write a MySQL query to get the second highest salary from an employee table with only one salary column.”
    • “Write a SQL query to find employees earning the second-highest salary in each department.”
  8. What is database normalization, and can you give a practical example?

    Asked in 12 of 612 interviews · last asked Oct 7 · Concept · Junior

    Show answer

    Database normalization organizes tables to reduce repeated data and prevent problems when inserting, updating, or deleting rows. For example, store customer details once in a Customers table instead of repeating them in every order. Each order links to its customer through a foreign key.

    • 1NF: Each field holds one value, with no repeating groups of columns.
    • 2NF: Meets 1NF; non-key columns depend on the whole candidate key, not just part of it.
    • 3NF: Meets 2NF; non-key columns do not depend indirectly on keys through other non-key columns.
    • Normalization makes updates safer, but reading related data may require more joins.
    Code
    Before:
    Orders(order_id PK, customer_id, customer_name)
    
    After:
    Customers(customer_id PK, customer_name)
    Orders(order_id PK, customer_id FK → Customers.customer_id)
    
    A customer name change now updates one row, not every order.

    What the interviewer checks: The interviewer checks whether you understand how table design reduces repeated data and prevents inconsistent updates.

    Other ways it was asked
    • “What is database normalization?”
    • “What is database normalization, and when would you use it?”
    • “What is normalization?”
  9. What are SQL window functions, and can you give examples of when to use them?

    Asked in 12 of 612 interviews · last asked Oct 7 · Concept · Mid-level

    Show answer

    SQL window functions calculate values across related rows without combining them into one row. They use an OVER clause to define those rows and their order. Common uses include ranking sales with RANK, calculating running totals with SUM, and comparing consecutive sales with LAG.

    • Ranking functions, such as ROW_NUMBER and RANK, assign positions; RANK gives equal values the same rank.
    • Aggregate window functions, such as SUM and AVG, calculate totals or averages while keeping individual rows.
    • Value and offset functions, such as FIRST_VALUE and LAG, return values from other rows.
    • PARTITION BY defines groups; window ORDER BY defines calculation order, not final output order.
    SQL
    SELECT sale_id, region, sale_date, amount,
           RANK() OVER (
               PARTITION BY region ORDER BY amount DESC) AS sale_rank,
           SUM(amount) OVER (
               PARTITION BY region ORDER BY sale_date, sale_id
               ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS running_total,
           LAG(amount) OVER (
               PARTITION BY region ORDER BY sale_date, sale_id) AS previous_amount
    FROM sales;

    What the interviewer checks: The interviewer checks whether you can choose a window function and explain how it preserves individual rows.

    Other ways it was asked
    • “What are SQL window functions, and when would you use them?”
    • “What types of SQL window functions do you know?”
    • “What are SQL window functions, and when would you use one?”
  10. What is a common table expression, and when would you use one?

    Asked in 12 of 612 interviews · last asked Sep 25 · Concept · Junior

    Show answer

    A common table expression (CTE) is a named query defined in a WITH clause that you can reference within one SQL statement. I use CTEs to break complex queries into clear steps. Recursive CTEs can handle hierarchies, such as employee reporting chains.

    • A CTE exists only within its statement; it is not a permanent table.
    • You can reference a CTE more than once in the same statement.
    • A CTE does not guarantee faster queries; execution depends on the database and query.
    • Recursive CTE syntax and limits vary by database.
    SQL
    WITH department_totals AS (
        SELECT department_id, SUM(salary) AS total_salary
        FROM employees
        GROUP BY department_id
    )
    SELECT department_id, total_salary
    FROM department_totals
    WHERE total_salary > 100000;

    What the interviewer checks: The interviewer is checking whether you understand CTE scope and how CTEs make complex SQL easier to read.

    Other ways it was asked
    • “What are common table expressions (CTEs), and how can they be used instead of subqueries?”
    • “What are SQL common table expressions (CTEs), and when would you use them?”
    • “What is a common table expression (CTE), and how is it used in a SQL query?”
  11. What is the N+1 query problem, and how can you avoid it?

    Asked in 12 of 612 interviews · last asked Oct 7 · Concept · Mid-level

    Show answer

    The N+1 query problem happens when one query loads a list, then a separate query loads related data for each item. These extra database calls can make the application slow as the list grows. Avoid it by using joins, eager loading, or batch queries to fetch related data together.

    • Lazy loading in an ORM can trigger a query each time related data is accessed.
    • Batch loading fetches related data for many items in one query instead of one query per item.
    • Joins can repeat parent data when each parent has multiple related rows.
    • Check query logs to spot repeated queries.

    What the interviewer checks: The interviewer is checking whether you recognize repeated database calls and know how to fetch related data efficiently.

    Common mistake (in 3 of 6 reviewed answers): Many answers forget that the pattern is one query for the list, followed by one extra query per item.

    Other ways it was asked
    • “What is the N+1 query problem, and how do you fix it?”
    • “What is the N+1 query problem?”
    • “How can you avoid the N+1 query problem?”
  12. What types of database indexes are there, and how do clustered and non-clustered indexes differ?

    Asked in 11 of 612 interviews · last asked Oct 10 · Concept · Mid-level

    Show answer

    Common index types include clustered, non-clustered, unique, columnstore, and full-text; support varies by database. In SQL Server, a clustered rowstore index stores table rows at its leaf level, ordered by key. A non-clustered index stores keys and row locators separately from the table. Indexes speed up reads but add storage and write costs.

    • SQL Server allows one clustered index per table and multiple non-clustered indexes.
    • Choose clustered keys for common range queries; prefer narrow, stable keys.
    • Use non-clustered indexes for other filters and joins; included columns can avoid extra row lookups.
    • Only ORDER BY guarantees query result order, even with a clustered index.

    What the interviewer checks: The interviewer checks whether you understand index storage, access patterns, and the trade-off between faster reads and slower writes.

    Other ways it was asked
    • “What is the difference between clustered and nonclustered indexes?”
    • “In SQL, what is the difference between clustered and nonclustered indexes?”
    • “What is the difference between clustered and nonclustered indexes in how they store data in SQL Server?”
  13. What is SQL?

    Asked in 10 of 612 interviews · last asked Oct 17 · Concept · Junior

    Show answer

    SQL stands for Structured Query Language. It is used to work with relational databases. You use it to read, add, change, and delete data, and to create or change database tables.

    • SQL describes what data you want, rather than each step to get it.
    • Common commands include SELECT, INSERT, UPDATE, and DELETE.
    • Databases such as PostgreSQL, MySQL, and SQL Server have differences in SQL syntax and features.

    What the interviewer checks: The interviewer is checking whether you know what SQL is and what it is used for.

    Other ways it was asked
    • “What is SQL, and what is it used for?”
    • “What does SQL stand for?”
  14. What does UNION do, and how does it differ from UNION ALL?

    Asked in 10 of 612 interviews · last asked Oct 7 · Concept · Junior

    Show answer

    UNION combines rows from multiple query results and removes duplicate rows. UNION ALL combines them but keeps duplicates. Use UNION when you need unique rows; use UNION ALL when duplicates are allowed or cannot occur, since it avoids duplicate removal.

    • Each query must return the same number of columns, with compatible types in matching positions.
    • UNION removes duplicates based on the whole row, not just one column.
    • UNION ALL usually runs faster because it does not remove duplicates.
    • Neither guarantees row order; use a final ORDER BY when order matters.

    What the interviewer checks: The interviewer is checking whether you understand duplicate handling, compatible query results, and the performance trade-off.

    Other ways it was asked
    • “What is the difference between UNION and UNION ALL?”
    • “What is the difference between UNION and UNION ALL in SQL?”
    • “Explain the difference between UNION and UNION ALL. When would you use each?”
  15. What are stored procedures, how do they work, and when would you use them instead of direct SQL?

    Asked in 10 of 612 interviews · last asked Oct 16 · Concept · Junior

    Show answer

    Stored procedures are named routines stored in a database that group SQL statements for reuse. You call them by name, often with parameters, and the database runs their logic. I use them for shared database tasks, controlled access, or fewer client calls; direct SQL is often simpler for small queries or logic that changes frequently.

    • Procedures avoid repeating the same SQL logic across applications.
    • They may return results or output parameters, depending on the database.
    • Call syntax, transaction rules, and permission behavior vary by database.
    • Stored procedures are not automatically faster than direct SQL.

    What the interviewer checks: The interviewer checks whether you understand how procedures run and when their benefits justify using them.

    Common mistake (in 3 of 5 reviewed answers): Many answers forget that stored procedures group SQL logic for reuse instead of repeating direct SQL calls.

    Other ways it was asked
    • “What are stored procedures, and when would you use them?”
    • “What are SQL stored procedures, and when would you use them?”
    • “What do you know about stored procedures?”
  16. What is the difference between a primary key and a unique constraint?

    Asked in 9 of 612 interviews · last asked Oct 16 · Concept · Junior

    Show answer

    A primary key identifies each row, enforces uniqueness, and normally forbids NULL. A unique constraint prevents duplicate values but may allow NULL, depending on the database. A table can have only one primary key, but it can have several unique constraints. Both can cover one column or a group of columns.

    • A primary key enforces uniqueness and normally forbids NULL.
    • A table has at most one primary key and can have several unique constraints.
    • For a multi-column key or constraint, the combination must be unique.
    • NULL handling in unique constraints differs between databases.

    What the interviewer checks: The interviewer is checking whether you understand row identity, uniqueness, NULL rules, and multi-column keys.

    Other ways it was asked
    • “What is the difference between a primary key and a unique key?”
    • “What is the difference between a unique key and a primary key?”
    • “What are the differences between a unique key and a primary key?”
  17. What is the difference between DELETE, TRUNCATE, and DROP?

    Asked in 8 of 612 interviews · last asked Oct 16 · Concept · Junior

    Show answer

    DELETE removes rows from a table, using WHERE to choose rows or removing all rows without it. TRUNCATE removes all rows but keeps the table structure. DROP removes the table itself, including its data and definition.

    • DELETE is DML; TRUNCATE and DROP are generally classified as DDL.
    • TRUNCATE does not accept WHERE and is usually faster than deleting all rows.
    • Foreign key constraints can prevent these operations.
    • Rollback support, trigger behavior, and identity resets depend on the database and command.

    What the interviewer checks: The interviewer checks whether you can choose the right command and understand what it removes.

    Other ways it was asked
    • “Could you explain the difference between DELETE, TRUNCATE, and DROP in SQL?”
    • “What is the difference between TRUNCATE and DELETE?”
    • “What is the difference between DROP and TRUNCATE?”
  18. What are the main types of SQL commands, and how do DDL and DML differ?

    Asked in 8 of 612 interviews · last asked Oct 1 · Concept · Junior

    Show answer

    The main groups are DDL (Data Definition Language), DML (Data Manipulation Language), DQL (Data Query Language), DCL (Data Control Language), and TCL (Transaction Control Language). DDL defines or changes database structures, while DML inserts, updates, or deletes data. SELECT is often called DQL, but some classifications include it in DML.

    • DDL commands include CREATE, ALTER, and DROP.
    • DML commands include INSERT, UPDATE, and DELETE.
    • DCL controls permissions with commands such as GRANT and REVOKE.
    • TCL manages transactions with commands such as COMMIT and ROLLBACK.

    What the interviewer checks: The interviewer checks whether you can distinguish structure changes, data changes, queries, permissions, and transaction control.

    Other ways it was asked
    • “What is the difference between DML and DDL?”
    • “Can you explain the difference between DML and DDL?”
    • “What do DDL and DML mean?”
  19. What are the disadvantages of database indexes, and how can too many hurt performance?

    Asked in 8 of 612 interviews · last asked Oct 2 · Concept · Mid-level

    Show answer

    Indexes can speed up reads, but they use extra storage and slow down writes. Inserts, deletes, and updates to indexed values also require index changes. Too many indexes add disk work, compete for memory, and increase maintenance costs, especially when few queries use them.

    • Indexes help locate rows without scanning the whole table, but not every query benefits.
    • Writes must maintain affected indexes, so extra indexes can reduce write speed.
    • Indexes need storage and can compete with table data for cache space.
    • Check query plans and index usage before removing unused or overlapping indexes.

    What the interviewer checks: The interviewer is checking whether you can balance faster reads against write, storage, and maintenance costs.

    Other ways it was asked
    • “What are the disadvantages of database indexes?”
    • “Why can using database indexes increase the number of operations?”
    • “What are the drawbacks of using database indexes?”
  20. How would you make payment processing idempotent so retries cannot create duplicate charges or credits?

    Asked in 8 of 612 interviews · last asked Oct 22 · Design · Senior

    Show answer

    Require a stable idempotency key for each payment, reused on retries. Store it durably with a unique constraint, and commit internal credits and the saved result in one database transaction. Return the saved result for completed retries; reject changed payment details. For external charges, reuse the provider’s idempotency key and reconcile uncertain outcomes before trying again.

    • Scope the unique key by merchant and operation; identical amounts alone do not identify duplicates.
    • Store the request details or hash, processing status, and response alongside the key.
    • Use the unique constraint to handle concurrent requests; report pending status while the original payment is unfinished.
    • Keep deduplication records through the retry window; without provider support, local transactions alone cannot prevent duplicate external charges.

    What the interviewer checks: The interviewer checks whether retries, concurrent requests, and crashes remain safe across both database updates and external payments.

    Other ways it was asked
    • “If a service restarts and an external service resends the same message for a 50,000-peso payment, how would you prevent the recipient from receiving 100,000 pesos?”
    • “If an external service resends the same 50,000-peso payment message after your service restarts, how would you prevent the recipient from receiving the payment twice?”
    • “How would you design the system so that if a service restarts and an external service resends the same 50,000-peso credit message, the customer is not credited twice? How would you handle a late event indicating that the transaction is already settled or in an intermediate state?”

SQL basics interview questions

Start with database basics, SQL commands, data types, NULL handling, and how relational databases compare with other database systems. 119 questions.

  1. What is a database?

    Asked in 5 of 612 interviews · last asked Oct 4 · Concept · Junior

  2. What is the difference between OLTP and OLAP systems?

    Asked in 4 of 612 interviews · last asked Sep 18 · Concept · Junior

    Other ways it was asked
    • “What is the difference between OLAP and OLTP?”
    • “What are OLAP and OLTP systems, and how do they differ?”
    • “What's the difference between OLAP and OLTP?”
  3. How do you approach writing SQL queries?

    Asked in 3 of 612 interviews · last asked Sep 8 · Tooling · Mid-level

    Other ways it was asked
    • “How do you approach writing and optimizing complex SQL queries?”
    • “What are the key concepts involved in writing SQL queries?”
  4. How does PostgreSQL differ from MySQL, and how is SQL related to both?

    Asked in 2 of 612 interviews · last asked Aug 14 · Concept · Junior

    Other ways it was asked
    • “What's the difference between SQL and PostgreSQL?”
  5. What is a relational database?

    Asked in 2 of 612 interviews · last asked Oct 21 · Concept · Junior

  6. What is PostgreSQL?

    Asked in 2 of 612 interviews · last asked Aug 14 · Concept · Junior

  7. What are the different types of databases?

    Asked in 2 of 612 interviews · last asked Oct 15 · Concept · Junior

    Other ways it was asked
    • “What are the different types of database relationships?”
  8. What does CRUD mean in DBMS?

    Asked in 2 of 612 interviews · last asked Sep 7 · Concept · Junior

    Other ways it was asked
    • “What are CRUD operations?”
  9. For a system like Instagram, would you choose a NoSQL or relational database? Give specific examples and explain why.

    Asked once · last asked May 11 · Design · Senior

    Other ways it was asked
    • “If you chose a NoSQL database for a system like Instagram, which one would you select, such as MongoDB, and why?”
  10. For a workload that retrieves complete rows, would you recommend a row-based RDBMS?

    Asked once · last asked Jul 29 · Scenario · Mid-level

    Other ways it was asked
    • “For a workload that retrieves complete rows, would you recommend a row-based RDBMS such as MySQL or a columnar database?”
  11. For an application storing videos and JSON-based metadata, why might PostgreSQL not be the best choice?

    Asked once · last asked Oct 19 · Concept · Senior

  12. How would you handle an insert that should update an existing row when a conflict occurs in PostgreSQL?

    Asked once · last asked Jan 28 · Tooling · Mid-level

All 119 SQL basics questions

Database design interview questions

Explore schemas, keys, constraints, relationships, and normalization, with questions about designing data models for application needs. 131 questions.

  1. What is the difference between a primary key and a foreign key?

    Asked in 7 of 612 interviews · last asked Oct 8 · Concept · Junior

    Other ways it was asked
    • “What are a primary key and a foreign key?”
    • “Can you explain the difference between a primary key and a foreign key in databases?”
    • “What is a primary key and what is a foreign key?”
  2. How would you design and create a database schema for a new application?

    Asked in 6 of 612 interviews · last asked Oct 12 · Scenario · Mid-level

    Other ways it was asked
    • “How would you design a database schema for an application, including its tables and choice of database tools?”
    • “How would you design a database schema and manage the database for an application?”
    • “What factors do you consider when designing a database and its tables, and how do you create them?”
  3. What is a primary key?

    Asked in 5 of 612 interviews · last asked Sep 9 · Concept · Junior

    Other ways it was asked
    • “What is a primary key, and why is it important?”
  4. Can you explain the first three normal forms in database normalization?

    Asked in 3 of 612 interviews · last asked Sep 8 · Concept · Mid-level

    Other ways it was asked
    • “What are the first three normal forms in database normalization?”
    • “Can you tell me more about specific normal forms, such as first normal form and third normal form, and their importance?”
  5. What types of relationships can exist between database tables?

    Asked in 3 of 612 interviews · last asked Oct 7 · Concept · Junior

    Other ways it was asked
    • “What other types of relationships can exist between database tables?”
  6. What is BCNF?

    Asked in 3 of 612 interviews · last asked Sep 9 · Concept · Junior

    Other ways it was asked
    • “Can you define BCNF and explain what it stands for?”
    • “Why is BCNF needed?”
  7. What is a foreign key?

    Asked in 3 of 612 interviews · last asked Sep 9 · Concept · Junior

  8. How many NULL values are allowed in a unique-key column?

    Asked in 2 of 612 interviews · last asked Oct 16 · Concept · Mid-level

    Other ways it was asked
    • “How many NULL values can a SQL UNIQUE constraint allow?”
  9. When modeling a new table in PostgreSQL, how do you decide between a natural key and a surrogate key, such as BIGSERIAL or UUID, and what performance or operational trade-offs drive that choice?

    Asked in 2 of 612 interviews · last asked Jul 27 · Concept · Senior

    Other ways it was asked
    • “When you are designing tables in PostgreSQL, what factors make you choose a UUID primary key versus a big serial or identity key?”
  10. How would you design users, roles, and matching at the database level?

    Asked in 2 of 612 interviews · last asked Jul 22 · Design · Mid-level

  11. In what real world scenarios would you intentionally denormalize a database?

    Asked in 2 of 612 interviews · last asked Sep 5 · Concept · Mid-level

    Other ways it was asked
    • “When would you intentionally denormalize a data model?”
  12. What are database constraints, and how do they help enforce data integrity?

    Asked in 2 of 612 interviews · last asked Jul 20 · Concept · Junior

    Other ways it was asked
    • “What are database constraints, and what types of constraints are there?”

All 131 Database design questions

SQL joins and aggregation interview questions

Work through query questions on filtering, joins, set operators, aggregate functions, GROUP BY, and HAVING. 135 questions.

  1. What are aggregate functions? Can you give an example?

    Asked in 6 of 612 interviews · last asked Sep 9 · Concept · Junior

    Other ways it was asked
    • “What are aggregate functions?”
    • “What are aggregate functions in SQL?”
    • “What is an aggregate function, and can you name a few commonly used aggregate functions in MySQL?”
  2. What does GROUP BY do in SQL, and when would you use it?

    Asked in 4 of 612 interviews · last asked Aug 25 · Concept · Junior

    Other ways it was asked
    • “When is GROUP BY used in SQL?”
    • “What is a SQL GROUP BY clause?”
    • “What does the SQL GROUP BY clause do?”
  3. What is a self-join, and when would you use one?

    Asked in 2 of 612 interviews · last asked Sep 16 · Concept · Junior

    Other ways it was asked
    • “What is a SQL self-join, and when would you use one?”
    • “What is the use of a self join?”
  4. Write a SQL query that joins the Users and Orders tables and counts orders.

    Asked in 2 of 612 interviews · last asked Jul 16 · Write code · Junior

    Other ways it was asked
    • “Given users and orders tables, how would you structure them and write a query to count orders per user?”
  5. What is a WHERE clause?

    Asked in 2 of 612 interviews · last asked Sep 8 · Concept · Junior

    Other ways it was asked
    • “What is the purpose of the WHERE clause in SQL?”
  6. What is the purpose of HAVING in SQL?

    Asked in 2 of 612 interviews · last asked Oct 11 · Concept · Junior

    Other ways it was asked
    • “When do we use the HAVING clause in SQL?”
  7. How would you query the customer, product, and sales tables to find customers who bought an iPad?

    Asked once · last asked Sep 21 · Write code · Junior

  8. Write an SQL query to find claims paid $500, submitted by providers flagged as IDIS in the last 60 days.

    Asked once · last asked Oct 13 · Write code · Mid-level

    Other ways it was asked
    • “Write an SQL query to find claims paid exactly $500 in the last 60 days and submitted by providers flagged as IDIS.”
    • “Write an SQL query to find high-risk claims paid at $500 in the last 60 days, submitted by providers flagged as IDIS.”
  9. How does SOQL handle object relationships differently from standard SQL joins?

    Asked once · last asked Aug 14 · Concept · Mid-level

    Other ways it was asked
    • “How does SOQL handle object relationships differently from standard SQL joins, and briefly, what's the difference between an inner join and a left join?”
  10. For a one-to-many relationship between two tables, which SQL join would you use to get the same results as Power BI?

    Asked once · last asked Aug 28 · Concept · Mid-level

  11. How would you find the records common to two sales tables in SQL?

    Asked once · last asked Sep 16 · Write code · Junior

    Other ways it was asked
    • “How would you find the records common to two tables in SQL?”
  12. Write a SQL query to list employees in Agra earning between 10,000 and 20,000.

    Asked once · last asked Oct 11 · Write code · Junior

All 135 SQL joins and aggregation questions

Advanced SQL query interview questions

These questions cover subqueries, CTEs, window functions, ranking, duplicates, and finding the latest record. 82 questions.

  1. Write an SQL query to find the highest-paid employee in each department.

    Asked in 7 of 612 interviews · last asked Sep 17 · Write code · Junior

    Other ways it was asked
    • “How would you write a SQL query to find the names of employees who receive the second highest salary in each department?”
    • “Given sales, orders, and employees tables, write a SQL query to find the employee who generated the highest sales amount in each department.”
    • “Write SQL to find the top three highest paid employees in each department.”
  2. How would you find duplicate records in SQL based on selected columns?

    Asked in 7 of 612 interviews · last asked Oct 17 · Tooling · Junior

    Other ways it was asked
    • “How would you identify duplicate records in a SQL table?”
    • “How can you use SQL to identify duplicate records in a table?”
    • “How would you find duplicate records in an employees table using SQL?”
  3. What is the difference between RANK and DENSE_RANK?

    Asked in 6 of 612 interviews · last asked Sep 21 · Concept · Junior

    Other ways it was asked
    • “What is the difference between ROW_NUMBER(), DENSE_RANK(), and RANK() in SQL?”
    • “What is the operational difference between ROW_NUMBER, RANK, and DENSE_RANK?”
    • “Provide a quick example of the operational differences between ROW_NUMBER, RANK, and DENSE_RANK window functions.”
  4. What is a subquery, and how would you use one?

    Asked in 4 of 612 interviews · last asked Sep 22 · Concept · Junior

    Other ways it was asked
    • “What is a subquery in SQL, and when would you use one?”
    • “What is a subquery in SQL?”
    • “What is a subquery?”
  5. How would you delete duplicate rows from a SQL table while keeping one copy?

    Asked in 4 of 612 interviews · last asked Oct 19 · Write code · Junior

    Other ways it was asked
    • “How would you delete duplicate rows from a product table based on product ID?”
    • “Can you write a SQL query to delete duplicate rows?”
    • “How do you remove duplicate records from a database table using SQL?”
  6. How would you use SQL to find the latest record for each user?

    Asked in 3 of 612 interviews · last asked Oct 7 · Write code · Junior

    Other ways it was asked
    • “How would you find the latest record per user in SQL?”
    • “How can you use SQL to retrieve the latest record for each employee?”
    • “How can you retrieve the latest record for an employee ID using SQL?”
  7. What is the difference between a CTE and a subquery?

    Asked in 3 of 612 interviews · last asked Sep 18 · Concept · Junior

    Other ways it was asked
    • “What is the difference between a subquery and a CTE?”
    • “Why do we need CTEs, and how are they different from subqueries?”
    • “Which is more efficient: a CTE or a subquery?”
  8. Why would you use DENSE_RANK() to find the third-highest salary in each department?

    Asked in 2 of 612 interviews · last asked Sep 10 · Concept · Mid-level

    Other ways it was asked
    • “Why might you choose DENSE_RANK() instead of ROW_NUMBER() or RANK() to find the top three highest-paid employees in each department?”
    • “Why might you use ROW_NUMBER() to find the second-highest salary in each department?”
  9. Write a SQL query to find customers whose total spending exceeds the average total spending per customer.

    Asked in 2 of 612 interviews · last asked Sep 17 · Write code · Mid-level

    Other ways it was asked
    • “How would you write a SQL query to find customers whose total order amount is greater than the average customer spend?”
  10. How would you bring each customer's latest login date from a table with multiple records per customer into a first table?

    Asked once · last asked Jun 17 · Scenario · Junior

    Other ways it was asked
    • “How would you write a SQL query to bring each customer's latest login date from a table with multiple records per customer into a first table?”
  11. How would you use a SQL window function to calculate the maximum total amount for each user ID?

    Asked once · last asked Sep 22 · Write code · Mid-level

    Other ways it was asked
    • “How does a MAX() window function calculate the maximum total amount for each user ID across rows?”
  12. How would you use SQL to uncover clinical insights that inform decision-making?

    Asked once · last asked Feb 11 · Behavioral · Mid-level

    Other ways it was asked
    • “Describe a project where you used SQL to uncover a critical clinical insight that influenced decision-making.”

All 82 Advanced SQL query questions

SQL views and stored procedures interview questions

Look at views, materialized views, stored procedures, functions, triggers, temporary tables, and procedural SQL. 68 questions.

  1. What are database triggers, and when would you use them?

    Asked in 6 of 612 interviews · last asked Sep 9 · Concept · Mid-level

    Other ways it was asked
    • “What is a database trigger, and when would you use one?”
    • “What are triggers in SQL?”
    • “What are some use cases for database triggers?”
  2. How do database functions and stored procedures differ, and when would you choose each?

    Asked in 5 of 612 interviews · last asked Sep 18 · Concept · Junior

    Other ways it was asked
    • “What is the difference between a function and a stored procedure?”
    • “What's the difference between functions and stored procedures?”
    • “What is the difference between a stored procedure and a function?”
  3. What is a materialized view, and when would you use one?

    Asked in 5 of 612 interviews · last asked Sep 18 · Concept · Mid-level

    Other ways it was asked
    • “What is the difference between a view and a materialized view?”
    • “When would you use a materialized view?”
    • “What are materialized views?”
  4. What are database views, and when would you use them?

    Asked in 5 of 612 interviews · last asked Sep 25 · Concept · Junior

    Other ways it was asked
    • “What is a SQL view, and why would you use one?”
    • “Can you explain SQL views?”
    • “What is a database view, and when would you use one?”
  5. How do BULK COLLECT and FORALL work together to process rows efficiently in PL/SQL?

    Asked in 2 of 612 interviews · last asked Sep 4 · Concept · Mid-level

    Other ways it was asked
    • “What is the difference between BULK COLLECT and FORALL in Oracle PL/SQL?”
    • “What performance bottlenecks can arise when processing rows with BULK COLLECT and FORALL, and how would you address them?”
  6. When would you use a stored procedure, a database function, or a view?

    Asked once · last asked Aug 20 · Concept · Mid-level

  7. What are join indexes and fully materialized views, and when would you use them?

    Asked once · last asked Feb 11 · Concept · Mid-level

  8. How do you design database tables and create stored procedures, views, and functions? Which database systems do you consider most robust, and why?

    Asked once · last asked Apr 14 · Concept · Mid-level

  9. How do you use SQL queries, data extraction, and stored procedures when working with relational databases?

    Asked once · last asked Jun 19 · Tooling · Mid-level

  10. In Oracle, what's the difference between a cursor FOR loop and using BULK COLLECT with FORALL, and when would you choose each for high-volume updates?

    Asked once · last asked Jun 25 · Concept · Senior

  11. When using BULK COLLECT with FORALL, how do you handle row-level errors so the batch can continue, and how do you capture which rows failed?

    Asked once · last asked Jun 25 · Scenario · Senior

  12. How would you write a stored procedure that generates a data file and saves it to a directory?

    Asked once · last asked Jul 16 · Tooling · Mid-level

All 68 SQL views and stored procedures questions

SQL query optimization and indexing interview questions

Investigate slow queries through questions on indexes, execution plans, statistics, pagination, partitioning, and checks that fixes preserve results. 238 questions.

  1. How do you determine which database columns should be indexed?

    Asked in 5 of 612 interviews · last asked Sep 28 · Scenario · Mid-level

    Other ways it was asked
    • “How do you determine which database indexes to create and which columns to index?”
    • “Which database columns would you index, and how would you decide?”
    • “How would you choose which columns to index in a database?”
  2. What are SQL execution plans, and how can you use them to investigate query performance?

    Asked in 5 of 612 interviews · last asked Oct 22 · Concept · Mid-level

    Other ways it was asked
    • “What is a SQL execution plan, and how do you use it to investigate query performance?”
    • “How do you use SQL execution plans to diagnose and optimize queries?”
    • “How do you read a SQL execution plan, and what information can it provide?”
  3. What’s the difference between EXPLAIN and EXPLAIN ANALYZE?

    Asked in 3 of 612 interviews · last asked Oct 13 · Concept · Mid-level

    Other ways it was asked
    • “What is the difference between EXPLAIN and EXPLAIN ANALYZE?”
  4. How do offset pagination and cursor pagination differ?

    Asked in 3 of 612 interviews · last asked Oct 14 · Concept · Mid-level

    Other ways it was asked
    • “What is the difference between using an offset and a cursor for database pagination?”
    • “Explain the trade-offs between offset pagination and cursor pagination.”
  5. How would you approach diagnosing an intermittent performance regression in an Entity Framework Core query without changing the database schema?

    Asked in 2 of 612 interviews · last asked May 16 · Scenario · Senior

    Other ways it was asked
    • “How would you approach diagnosing an intermittent performance regression in an EF Core query without changing the database schema?”
  6. Which data structure is commonly used for indexing in a database management system?

    Asked in 2 of 612 interviews · last asked Aug 27 · Concept · Junior

    Other ways it was asked
    • “What data structures are commonly used to implement database indexes?”
  7. When would you use table partitioning in a database?

    Asked in 2 of 612 interviews · last asked Sep 24 · Concept · Mid-level

    Other ways it was asked
    • “If a database table is partitioned, when might splitting the data into separate tables still be necessary?”
  8. When you filter or aggregate early to improve performance, what concrete validation checks do you run to prove the KPI results stay equivalent or quantify the delta?

    Asked in 2 of 612 interviews · last asked Oct 15 · Scenario · Senior

    Other ways it was asked
    • “When you aggregate or filter before a join, how do you verify you haven't introduced bias or changed KPI definitions? What checks do you run?”
  9. Does keyset pagination work when IDs aren’t numerical or don’t grow linearly?

    Asked once · last asked Oct 19 · Concept · Mid-level

    Other ways it was asked
    • “Can keyset pagination work when IDs aren’t numerical or don’t grow linearly, such as random UUIDs?”
    • “Assuming employee IDs grow linearly, will keyset pagination work?”
  10. In a query joining a large fact table to multiple dimensions, what indicators tell you the plan is inefficient?

    Asked once · last asked Aug 23 · Scenario · Senior

    Other ways it was asked
    • “When a query joining a large fact table to multiple dimensions has an inefficient execution plan, what indicators would you look for, and what indexing or partitioning changes would you try first?”
  11. For a table with roughly 1.5–2 billion rows, how would you choose between range and hash partitioning for performance optimization, and what factors would guide your decision?

    Asked once · last asked Dec 15 · Scenario · Senior

    Other ways it was asked
    • “For a table with roughly 1.5–2 billion rows, how would you choose a hash partition count, and when would hash partitioning be preferable to range partitioning?”
  12. For a status column with few distinct values, what index strategy would you consider, and why?

    Asked once · last asked Jan 28 · Scenario · Senior

All 238 SQL query optimization and indexing questions

SQL transactions and concurrency interview questions

Check your understanding of ACID, isolation, locks, deadlocks, transaction management, idempotency, and consistency across databases, caches, and events. 160 questions.

  1. What is a database transaction, and when would you use one?

    Asked in 6 of 612 interviews · last asked Oct 21 · Concept · Junior

    Other ways it was asked
    • “What is a database transaction?”
    • “What are database transactions, and when would you use them?”
    • “What are database transactions, and when should you use them?”
  2. What is the difference between optimistic and pessimistic concurrency control?

    Asked in 5 of 612 interviews · last asked Oct 12 · Concept · Mid-level

    Other ways it was asked
    • “What is the difference between pessimistic and optimistic locking?”
    • “How do optimistic and pessimistic locking work?”
    • “What is the difference between pessimistic locking and optimistic locking?”
  3. In Spring, does @Transactional work when one method calls another @Transactional method in the same class?

    Asked in 3 of 612 interviews · last asked Sep 1 · Concept · Senior

    Other ways it was asked
    • “If a method annotated with @Transactional is called from another method in the same class, will a transaction start?”
    • “What happens in Spring when one transactional method calls another transactional method?”
  4. What is a database deadlock, and why does it occur?

    Asked in 3 of 612 interviews · last asked Oct 2 · Concept · Mid-level

    Other ways it was asked
    • “What is a database deadlock?”
  5. What are the transaction isolation levels?

    Asked in 2 of 612 interviews · last asked Mar 2 · Concept · Mid-level

    Other ways it was asked
    • “What is the highest transaction isolation level?”
  6. How do you use transaction propagation in an application?

    Asked in 2 of 612 interviews · last asked Oct 12 · Concept · Mid-level

    Other ways it was asked
    • “Can you explain transaction propagation?”
  7. What are distributed transactions, and when would you use them?

    Asked in 2 of 612 interviews · last asked Aug 19 · Concept · Mid-level

    Other ways it was asked
    • “What are some alternatives to distributed transactions?”
  8. What is the use of the @Transactional annotation?

    Asked in 2 of 612 interviews · last asked Oct 12 · Concept · Mid-level

    Other ways it was asked
    • “Why should we use the @Transactional annotation?”
    • “What does the @Transactional annotation do in Spring, and what conditions must be met for it to work?”
  9. How would you handle atomicity when updating both a cache and a database?

    Asked once · last asked Mar 16 · Design · Senior

    Other ways it was asked
    • “How can you make an operation that updates both a cache and a database atomic?”
  10. What is a serializable schedule, and how do you determine whether a schedule is serializable?

    Asked once · last asked Oct 10 · Concept · Mid-level

    Other ways it was asked
    • “What is a serializable transaction schedule?”
  11. How would you implement optimistic concurrency checking, for example with a timestamp or version?

    Asked once · last asked Jan 28 · Scenario · Senior

  12. How does PostgreSQL handle concurrent reads and writes?

    Asked once · last asked Jan 28 · Concept · Senior

All 160 SQL transactions and concurrency questions

Database integration and security interview questions

Questions here cover database connections, ORMs, application data flows, access controls, encryption, SQL injection, and safe AI access to data. 110 questions.

  1. How do you connect a Spring Boot application to a database?

    Asked in 2 of 612 interviews · last asked Sep 30 · Tooling · Junior

    Other ways it was asked
    • “How do you connect a database to a Spring Boot application?”
  2. What are the differences between using an ORM and writing raw SQL queries?

    Asked in 2 of 612 interviews · last asked Oct 7 · Concept · Mid-level

    Other ways it was asked
    • “Why use an ORM instead of writing only raw SQL?”
  3. What is row-level security, and how can it be used?

    Asked in 2 of 612 interviews · last asked Oct 21 · Concept · Mid-level

    Other ways it was asked
    • “What is row-level security?”
  4. What is JDBC?

    Asked in 2 of 612 interviews · last asked Jul 21 · Concept · Junior

  5. How do you configure connectivity from Azure Data Factory to an on-premises SQL Server, and what connection parameters are required?

    Asked once · last asked Aug 19 · Tooling · Mid-level

    Other ways it was asked
    • “How do you establish connectivity and move data between Azure Data Factory and an on-premises SQL Server?”
    • “How do you configure connectivity between Azure Data Factory and an on-premises SQL Server?”
  6. What are ORM and Active Record, and how are they used to work with databases?

    Asked once · last asked Mar 27 · Concept · Mid-level

  7. How can an Azure Function read from or write to a database while processing a request?

    Asked once · last asked May 7 · Tooling · Mid-level

  8. When importing database rows into an application, how would you generate a unique key and validate missing values?

    Asked once · last asked Aug 22 · Scenario · Mid-level

    Other ways it was asked
    • “When importing database rows into an application, how would you generate a unique key and assign values for missing fields?”
  9. How would you verify an AI agent's SQL read and write actions before allowing them to reach production?

    Asked once · last asked Sep 8 · Scenario · Senior

    Other ways it was asked
    • “How would you verify an AI agent's SQL read and write actions before production, for example with dry-run transactions or approval gates?”
  10. How would you design an AI bot that converts natural-language questions into safe SQL queries against a customer database?

    Asked once · last asked Sep 25 · Design · Senior

    Other ways it was asked
    • “How would you design an AI bot that accepts natural-language questions, queries a customer's SQL database, and responds through a website?”
  11. What is the difference between a .NET application calling SQL Server and SQL Server calling .NET code?

    Asked once · last asked Sep 25 · Concept · Mid-level

  12. How would you retrieve the dynamic data from the live database, including through MCP?

    Asked once · last asked Feb 5 · Scenario · Mid-level

All 110 Database integration and security questions

Database administration and scaling interview questions

Review migrations, backups, recovery, replication, high availability, cloud services, sharding, and data pipelines using CDC, ETL, and analytics platforms. 169 questions.

  1. What is database replication?

    Asked in 2 of 612 interviews · last asked Feb 22 · Concept · Junior

    Other ways it was asked
    • “What is database replication, and what is it used for?”
    • “How does database replication work, and what is it used for?”
    • “How does database replication work?”
  2. What first steps would you take on both the database and application sides when migrating from Oracle to PostgreSQL?

    Asked in 2 of 612 interviews · last asked Oct 16 · Scenario · Mid-level

    Other ways it was asked
    • “If I were asked to migrate from Oracle to PostgreSQL, what would I consider first?”
    • “What analysis points would you consider when migrating both the application and database from Oracle to PostgreSQL?”
    • “How would you migrate a database from Oracle to PostgreSQL, and what challenges would you address?”
  3. How would you migrate an on-premises database to SQL Server?

    Asked in 2 of 612 interviews · last asked Aug 21 · Scenario · Mid-level

    Other ways it was asked
    • “If you want to migrate an on-premises application to Azure, how would you do that?”
    • “How would you migrate an on-premises database to Azure SQL?”
  4. On an Oracle RAC cluster, how do you manage service relocation, and what are your best practices for optimization?

    Asked in 2 of 612 interviews · last asked Jul 16 · Tooling · Senior

    Other ways it was asked
    • “How do you relocate a service in an Oracle RAC cluster?”
  5. Which command do we use to create a managed table in Databricks?

    Asked in 2 of 612 interviews · last asked Aug 26 · Tooling · Junior

    Other ways it was asked
    • “How do we create a table in Databricks?”
  6. How would you back up a SQL database table before making changes?

    Asked once · last asked Oct 9 · Tooling · Mid-level

  7. What managed SQL database services are available in AWS, GCP, and Azure, and how do they compare with on-premises SQL Server?

    Asked once · last asked Feb 7 · Concept · Mid-level

  8. How do you manage database migrations in PostgreSQL while ensuring data integrity?

    Asked once · last asked Jun 26 · Scenario · Mid-level

    Other ways it was asked
    • “How can database migrations in PostgreSQL help preserve data integrity? Can you give an example?”
  9. What would you want to understand before migrating R pipelines to dbt or PostgreSQL?

    Asked once · last asked Sep 9 · Scenario · Mid-level

    Other ways it was asked
    • “What would you assess, and what issues would you look for, when migrating R pipelines to dbt or PostgreSQL?”
    • “How would you approach migrating an R data pipeline to PostgreSQL?”
  10. Can you rename a column in a Microsoft Fabric Warehouse using the SQL endpoint?

    Asked once · last asked Sep 16 · Concept · Mid-level

  11. How would you ingest changes from an on-premises SQL Server database, and why choose direct reads or transaction-log CDC?

    Asked once · last asked Sep 16 · Scenario · Senior

    Other ways it was asked
    • “How would you design ingestion from an on-premises SQL Server database, choosing between direct reads and transaction-log CDC?”
  12. How would you create a custom SQL test in dbt?

    Asked once · last asked Sep 20 · Tooling · Mid-level

All 169 Database administration and scaling questions

Live coding round next? Coding mode in the MeetAssist desktop app solves the problem on your screen, with your phone as the remote.

How this list is made

Every question here was asked by a real interviewer in a real job interview that a candidate ran MeetAssist in. After the call, the interviewer's questions are pulled from the transcript. Practice sessions, tests, exams and anything that was not a job interview are dropped.

Questions are rewritten so they make sense on their own: names of people, employers and clients are removed, and speech-to-text mistakes are fixed. Small talk, logistics and questions about one candidate's own résumé are left out. Rephrasings of the same question are merged, and the count is the number of different interviews it came up in.

The interviews come from candidates who use MeetAssist, so they lean towards software, data and AI roles: the shares describe these interviews, not every SQL interview. Answers to the most asked questions are written and checked by an editor; a "common mistake" is shown only when reviews of real answers in these interviews show it, with the count.

612 interviews, 357 candidates, Nov 2025 to Oct 2026. Updated every month with new interviews.