Sector file // sql
SQLDECODED.
Joins, indexes & queries
Easy
6 questionsWhat is the logical order of execution of a SQL query?
DSA · 1.1k views · order-of-execution
What is the difference between WHERE and HAVING?
DSA · 1.0k views · where, having
What are NOT NULL, DEFAULT and other column constraints?
DSA · 524 views · constraints
What is SQL injection and how do parameterized queries prevent it?
DSA · 374 views · security, injection
What do COALESCE and NULLIF do?
DSA · 209 views · coalesce, null
What is a CHECK constraint?
DSA · 122 views · check-constraint
Medium
15 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
Covering 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
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
What is a view and a materialized view?
DSA · 935 views · view
What are foreign key cascade options?
DSA · 799 views · foreign-key, cascade
Filtered vector search with pgvector — how do you combine WHERE category = 'X' with ORDER BY embedding <=> $1?
System Design · 752 views · pgvector, filtering, ann
What is the difference between UNION and UNION ALL?
DSA · 594 views · union
Hard
7 questionsJSONB vs normalized columns vs EAV — how do you model flexible attributes without killing query performance?
System Design · 1.1k views · jsonb, data-modeling, schema-design
RANK() 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
What is a LATERAL join?
DSA · 970 views · lateral
Why does column order matter in a composite index?
DSA · 585 views · composite-index
pgvector cosine similarity index in 2025-26 — HNSW vs IVFFlat for semantic search at scale?
System Design · 465 views · pgvector, hnsw, cosine-search
LATERAL vs Window Function vs Correlated Subquery for top-N per group — which scales when?
System Design · 221 views · lateral-join, query-planning, performance
What is table partitioning?
DSA · 44 views · partitioning
Seen a SQL question that is not here? Add it and help the next candidate.
Share a question