🗄️22 questions
SQL
Joins, indexes, transactions, query optimization.
JoinsIndexesTransactionsNormalizationWindow FunctionsOptimization
Sample Questions (22 live)
JoinsEasy
Explain INNER JOIN vs LEFT JOIN.
InfosysTCSDeloitteRead →
IndexesMedium
What is a database index and what is the trade-off?
AmazonDeloitteRead →
OptimizationEasy
WHERE vs HAVING — what's the difference, and which is faster?
InfosysTCSCognizantRead →
TransactionsEasy
DELETE vs TRUNCATE vs DROP — how do they differ, and which is transactional?
TCSInfosysWiproRead →
OptimizationEasy
UNION vs UNION ALL — why does the wrong one quietly slow your query?
InfosysCognizantAccentureRead →
NormalizationEasy
Primary key vs unique key vs foreign key — and how do they relate to indexes?
TCSInfosysDeloitteRead →
OptimizationMedium
How do you read an execution plan to find why a query is slow?
AmazonMicrosoftDeloitteRead →
IndexesMedium
How does a composite index work, and what is the leftmost-prefix rule?
AmazonMicrosoftGoogleRead →
IndexesMedium
What is a covering index, and how does it eliminate table lookups?
AmazonMicrosoftDeloitteRead →
TransactionsMedium
Explain ACID and the four transaction isolation levels — which is the default?
AmazonMicrosoftDeloitteRead →
TransactionsMedium
Dirty read, non-repeatable read and phantom read — what are they and how do you prevent each?
AmazonMicrosoftbankingRead →
OptimizationMedium
What is the N+1 query problem, and how do you fix it in an ORM?
AmazonDeloitteCognizantRead →
IndexesMedium
Clustered vs non-clustered index — how do they physically differ?
AmazonMicrosoftOracle-shopsRead →
Window FunctionsMedium
What problems do window functions solve that GROUP BY can't?
AmazonGoogleMicrosoftRead →
OptimizationMedium
Why is OFFSET pagination slow at scale, and how does keyset (cursor) pagination fix it?
AmazonGoogleMicrosoftRead →
TransactionsMedium
Optimistic vs pessimistic locking — which do you use for concurrent updates?
AmazonMicrosoftbankingRead →
OptimizationHard
An index exists but the query still does a full scan — what are the likely reasons?
AmazonMicrosoftOracle-shopsRead →
TransactionsHard
What causes database deadlocks, and how do you prevent them in a busy OLTP system?
AmazonMicrosoftbankingRead →
OptimizationHard
Walk me through diagnosing a slow query in production.
AmazonMicrosoftGoogleRead →
NormalizationHard
When do you deliberately denormalize, and what are the trade-offs?
AmazonMicrosoftGoogleRead →
OptimizationHard
What causes database connection-pool exhaustion, and how do you fix it?
AmazonMicrosoftDeloitteRead →
OptimizationHard
How do you keep queries fast on a table with billions of rows?
AmazonGoogleMicrosoftRead →
Advertisement
Google AdSense slot