Sector file // sql
SQLDECODED.
Joins, indexes & queries
Easy
9 questionsWhat is the CASE expression?
DSA ยท 1.0k views ยท case
What is the difference between WHERE and HAVING?
DSA ยท 1.0k views ยท where, having
What are the different types of SQL joins?
DSA ยท 985 views ยท sql, joins
What does DISTINCT do and what is its cost?
DSA ยท 859 views ยท distinct
How do you find duplicate rows in a table?
DSA ยท 694 views ยท duplicates, group-by
When would you use a transaction explicitly?
DSA ยท 604 views ยท truncate-vs-delete
What is a CROSS JOIN and when is it useful?
DSA ยท 484 views ยท joins
What is a CHECK constraint?
DSA ยท 122 views ยท check-constraint
Medium
30 questionsTop-N per group with RANK() OVER (PARTITION BY) โ how do you get top 2 per department without collapsing rows?
DSA ยท 1.2k views ยท window-functions, rank, partition
Advanced UPSERT patterns โ conditional updates, xmax detection, and soft-delete-aware indexes?
System Design ยท 1.2k views ยท upsert, idempotency, constraints
What is a subquery and what is a correlated subquery?
DSA ยท 1.2k views ยท subquery
How do you read an EXPLAIN query plan?
DSA ยท 1.1k views ยท explain
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
What are transaction isolation levels?
DSA ยท 924 views ยท isolation-levels
Hard
8 questionsRANK() vs DENSE_RANK() vs ROW_NUMBER() โ when does the gap matter and how do you choose?
DSA ยท 1.1k views ยท window-functions, ranking, dense-rank
SKIP LOCKED for job queues โ how do you build a concurrent queue without race conditions?
System Design ยท 857 views ยท skip-locked, queue, concurrency
How do you optimize a slow SQL query?
DSA ยท 816 views ยท query-optimization
How do you pivot rows into columns?
DSA ยท 651 views ยท pivot
How do you solve gaps-and-islands problems in SQL?
DSA ยท 511 views ยท window-functions, gaps-and-islands
pgvector cosine similarity index in 2025-26 โ HNSW vs IVFFlat for semantic search at scale?
System Design ยท 465 views ยท pgvector, hnsw, cosine-search
What is a deadlock and how do you prevent it?
DSA ยท 366 views ยท deadlock
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