SQL Interview Questions
Practice SQL interview questions from top companies. Filter by difficulty, role, and SQL concept.
All SQL Questions
Transform DataFrame and compute diff-in-diff
Train and analyze a classifier
Write SQL to compare social-only vs game-only engagement
Write SQL for influence score and follower growth
Compute video-call SQL metrics with edge cases
Compute reply-based user metrics in 7 days
Write SQL for late-delivery metrics by window
Debug ML pipeline and build text parser
Analyze time-zoned events with pandas
Print the K-th non-empty line
Write SQL for content-view analytics
Write SQL for percent and window changes
Compute ads revenue by geography in SQL
Write SQL for profit, growth, retention
Compute CTR and metrics with pandas
Compute percent of active users with 50+ calls
Recommend two-hop follows in Python
Write SQL for top categories and highly active users
Implement vectorized NumPy ops and explain broadcasting
Find top category by video time spent
Compute C/T metrics from bookings and visits
Debug and harden trial-assignment Python code
Compute active ad revenue by creation source
Write monthly customer and sales SQL queries
Compute percent of first-cancel users who never return
Aggregate D1 retention cohorts in SQL
Parse and build binary data in Python
Solve three SQL problems (easy/medium/hard)
Transform flat keys into nested dictionary
Determine Maximum Consecutive Order Days Per User
Analyze shopping funnel with joins and windows
Explain handling very large datasets
Refactor SQL into an aggregated report
Compute violation rate and flag precision in SQL
Tackle Python tasks under time pressure
Implement paginated API ingestion
Implement scalable word count locally
Measure Late Deliveries and Identify Top Delayed Restaurants
Write SQL to compute campaign net revenue
Compute CTR by pin_format and date
Analyze video flags and reviews with SQL
Compare list/dict; parse JSON/CSV at scale
Compute CTR drop with exclusions
Write SQL for fares and age-band counts
Compute paid subscriber YoY counts by month
Write SQL using HAVING and window functions
Write SQL for retention, conversion, and churn
Write SQL to find top net-revenue products
Write SQL and Python for transaction analytics
How to Prepare for SQL Interviews
SQL interviews for data analyst, data scientist, and software engineering roles focus heavily on your ability to write efficient queries and understand relational database concepts. Success requires mastering both fundamental syntax and advanced techniques that appear frequently in real interviews.
Master the Core Concepts
Start with JOINs, window functions, CTEs, and aggregations - these form the foundation of most interview questions. Understanding when to use INNER JOIN versus LEFT JOIN, or knowing the difference between ROW_NUMBER() and RANK(), will help you solve 80% of SQL interview problems.
Common Patterns You'll See
Companies like Meta, Google, and Amazon frequently test specific patterns: Top-N per group, deduplication, rolling metrics, retention cohorts, funnel conversion, and sessionization.
Practice with Real Company Questions
The best way to prepare is practicing questions from your target companies. Use the company filter above to practice relevant questions.