SQL Interview Questions
Practice SQL interview questions from top companies. Filter by difficulty, role, and SQL concept.
All SQL Questions
Analyze Mission Outcomes and Allocate Response Units
Analyze a Regression Dataset and Build a Safe File-Processing Utility
Analyze Pirated Theme Usage
Implement a Safe Average Function in Python
Write SQL for repeat churn
Find Values Owned Only by the Selected User
Analyze Pirated Theme Usage Impact
Compute Ride Metrics in SQL
SQL: Top 5 Vehicle Models by Miles per kWh Under a Maintenance Cost Cap
Compare Survey Satisfaction for New and Established Users
Number Entries Within Each Conversation
Analyze Returning Borrowers Across Two Days of Logs
Find Users with Seven Consecutive Impression Days
Continue Entry Numbers for a Daily Incremental Batch
Count Users Active After Signup
Calculate Daily Survey Response Rates by Country
Reason About Composite Join Keys and Predicate Placement
Rank Departments by Student Count
SQL: Users With No Rides in the Most Recent 7-Day Window, Including Non-Riders
Aggregate User Events and Check Join Uniqueness
SQL: Zero-Filled DAU, Rolling 30-Day MAU, and the MAU Impact of a User-ID Rehash
Rank Customers by Monthly Revenue with Competition Ties
Explore Employee and Session Audit Tables Before Analysis
Measure Customers Ordering from Bottom-Quartile Restaurants
Define and Analyze Early Engagement
Return Every Employee with a Mapped or Default Unique ID
Calculate the Median House Price in Each City
Single-Pass Python Cleaning Pipeline for Million-Document Web Crawl Parquet Files
Longest Meeting-Free Business-Hours Block per Employee and Day
SQL: Average Ride Rating in Users' First and Third Active Months by City
Calculate Average Camera Switches per Session
Estimate Page-Visit Duration from the Next User Event
Find the Longest Calendar-Day Streak with All Employees Present
Analyze User Ride Activity with SQL
SQL: Count Users With Zero or One Rides per City
Reconcile Monthly Bank-Account Balances Across Two Datasets
Calculate First-Week Retention by Signup Cohort
Load Daily JSONL LLM Chat Logs Into a Warehouse: Schema, Validation, Dedup, Idempotency
Compute a Rolling Seven-Day Revenue Sum with Missing Dates
Find Hosts Meeting Listing, Rating, and Review-Coverage Rules
Compare First-Week Retention by Plan Type
Sum Employee Working Time from Ordered Check-In and Check-Out Events
SQL: Monthly Ride Totals and Average Ratings, Newest Month First
Find the Latest Balance for a Bank Account
Count Users Retained on Day Seven
Calculate the Percentage of Highly Active Users by Country
Calculate the 2023 Session Signup Rate
Classify Tree Nodes in SQL
Model Data for Analytics, Reporting, and Applications
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.