SQL Developer Interview Questions & Answers
40 questions for SQL Developer interviews — 4 easy, 33 medium, 3 hard.
About the SQL Developer role
A SQL Developer writes and maintains queries, views, stored procedures, functions and triggers that support applications and reports. They optimise slow queries, design tables with the application team and ensure data integrity through constraints and transactions. The role is common in IT services, banking and product companies that run large relational databases.
What is the CASE expression and where can it be used?
Show answer
An interviewer asks for the Nth highest salary in a reusable way. How do you answer?
Show answer
You need to delete duplicate rows but keep one copy of each. How do you do it?
Show answer
What is the difference between an index scan and an index seek?
Show answer
What is NULL in SQL and how do you compare it?
Show answer
How do you read an EXPLAIN ANALYZE output in PostgreSQL?
Show answer
Tell me about a time you significantly improved query performance.
Show answer
Why is NOT IN dangerous when the subquery contains NULL?
Show answer
Rewrite a nested query using CTEs for readability.
Show answer
Create an index to speed up searching orders by customer and date.
Show answer
Write a query to pivot order counts by status into columns.
Show answer
Describe a time you found and fixed a wrong number in a report.
Show answer
What is the difference between a stored procedure and a function?
Show answer
A query that ran in 1 second now takes 40 seconds after a data load. What do you check?
Show answer
An interviewer asks how you would find why a query is slow. What steps do you describe?
Show answer
Write an upsert that inserts a row or updates it if it exists.
Show answer
How does LIKE work and what are wildcards?
Show answer
A query with a correlated subquery in SELECT runs for every row and is slow. How do you improve it?
Show answer
When should you not create an index?
Show answer
What is the difference between a CTE, a subquery, a temp table and a view?
Show answer
Two users book the last seat at the same time and both succeed. How do you fix it?
Show answer
How do you get the top 3 rows in different databases?
Show answer
How do you insert, update and delete a row?
Show answer
Create an audit trigger that logs salary changes.
Show answer
What is a materialised view?
Show answer
Why should we hire you for a SQL or data role as a fresher?
Show answer
Compare this month's and last month's sales per product using a full outer join.
Show answer
Describe a time you reviewed someone else's SQL and suggested improvements.
Show answer
What are dirty reads, non-repeatable reads and phantom reads?
Show answer
A query uses SELECT * on a table with 80 columns. Why is that a problem?
Show answer
What is the difference between UNION and UNION ALL?
Show answer
Rewrite a non-SARGable date filter to use an index.
Show answer
What is MVCC and how does it improve concurrency?
Show answer
What is a deadlock and how do databases handle it?
Show answer
What is a SARGable query and why does it matter?
Show answer
Find departments where every employee earns above 40000.
Show answer
You need to update 50 million rows in production. How do you do it safely?
Show answer
You added an index but the query still does a full table scan. Why might that be?
Show answer
How would you design data archiving for a table growing by 10 million rows a month?
Show answer
Frequently asked questions
What does a SQL Developer do?
A SQL Developer writes and maintains queries, views, stored procedures, functions and triggers that support applications and reports. They optimise slow queries, design tables with the application team and ensure data integrity through constraints and transactions. The role is common in IT services, banking and product companies that run large relational databases.
Which skills are tested in a SQL Developer interview?
Expect questions on Stored procedures, Query optimisation, Database design, Transactions, Version control. Most rounds also ask you to explain a project and solve one practical problem live.
How do I prepare for a SQL Developer interview?
Revise SQL Basics, Subqueries and CTEs, Transactions and Advanced SQL, Indexes and Performance first using the topic sheets, practise the questions on this page aloud, then do one full mock interview to practise timing.