Sector file // sql
SQLDECODED.
Joins, indexes & queries
Easy
4 questionsWhat is the difference between a primary key and a foreign key?
DSA · 1.2k views · primary-key, foreign-key
What is the logical order of execution of a SQL query?
DSA · 1.1k views · order-of-execution
What is the CASE expression?
DSA · 1.0k views · case
What do COALESCE and NULLIF do?
DSA · 209 views · coalesce, null
Medium
16 questionsCovering indexes (INCLUDE) and Bitmap Heap Scans — how do you eliminate heap fetches in 2025?
System Design · 1.2k views · covering-index, bitmap-scan, vacuum
How do you read an EXPLAIN query plan?
DSA · 1.1k views · explain
What is a covering index?
DSA · 1.1k views · covering-index
How does GROUP BY work with aggregate functions?
DSA · 1.1k views · group-by, aggregate
What is the difference between COUNT(*), COUNT(col), and COUNT(DISTINCT col)?
DSA · 967 views · count
EXPLAIN ANALYZE shows Seq Scan on a 10M-row table — how do you diagnose and fix it?
System Design · 963 views · explain, seq-scan, index-scan
Why might EXISTS outperform a JOIN for existence checks?
DSA · 948 views · exists, performance
How does SQL handle NULL values?
DSA · 940 views · null
Hard
4 questionsSerializable isolation pitfalls — write skew, retry storms, and when advisory locks beat SSI?
System Design · 1.1k views · isolation, serializable, write-skew
How do you optimize a slow SQL query?
DSA · 816 views · query-optimization
Why does column order matter in a composite index?
DSA · 585 views · composite-index
LATERAL vs Window Function vs Correlated Subquery for top-N per group — which scales when?
System Design · 221 views · lateral-join, query-planning, performance
Seen a SQL question that is not here? Add it and help the next candidate.
Share a question