SQL Interview Questions
Joins, aggregation, window functions, CTEs and the query patterns interviewers actually ask. All 433 are original problems with instant in-browser grading — pick one and start solving free.
Easy SQL questions 134
- Above-Average Campuses
- Adjacent Open Parking Spots
- App Ad Click-Through Rate
- Asset Labels With a Three-Digit Code
- Average Listening Sessions per Listener
- Average Nightly Rate Earned per Room
- Average Reviewer Tenure per Grant
- Average Workout Duration per Treadmill
- Best Recorded Time per Runner
- Big-Spender Diners
- Books Missing a Record
- Build a Savory-and-Sweet Combo
- Busiest Reading Circles
- Can Three Beams Form a Bracket
- Chefs Who Tasted Their Own Dish
- Chess Club Standings
- Class Attendance for Every Member and Class
- Classifying Bracing Frames
- Clean-Rated Audiobooks Aired in March
- Closest Mileposts on a Trail
- Counting Package Registries
- Coupon Redemption Rate
- Couriers per Depot
- Course Fee per Campus
- Course of Each Learner's First Enrollment
- Credit Card Issuance Gap
- Daily Distinct Buyers and Couriers
- Daily Distinct Gym Visitors
- Days the Reservoir Rose
- Device Type Viewership Split
- Distinct Languages Spoken by Each Guide
- Distinct Vehicle Types Parked per Day
- Drivers With Low or No Tips
- Each Author's Home Library
- Each Member's First Gym Visit
- Edition Catalogue Report
- Email Campaign Open Rate
- Email Domain Distribution
- Enrollments in Missing Courses
- Espresso Drinkers Who Skip Matcha
- Every Debate Pairing in the Tournament
- Flagged Support Messages
- Flip the Winning Side
- Format the Conference Badge Label
- Frequent Host-Guest Pairs
- Garages With No Free Spaces
- Gluten-Free Vegan Menu Items
- Gyms With Membership Growth in 2023
- High-Balance Loyalty Members
- Highest Unique Queue Ticket
- iPhone Trade-In Revenue by Store
- Keep the Earliest Newsletter Signup
- Library Entries Without a Checkout
- Listeners Who Beat Their Own Average
- Lookup Reservoir Levels
- Members Active in Two Quarters
- Members Who Outscore Their Team Leader
- Members Who Qualify for Loyalty Points
- Members Who Qualify for Loyalty Points (List)
- Members With Both Plans
- Mentees per Mentor
- Menu Item Totals Across Tickets
- Monthly Product Review Averages
- Monthly Stream Activity Above the Royalty Floor
- Most Recent 2022 Backup
- Most Recent Check-In per Locker
- Multi-Skill Candidate Filter
- New Customer Acquisition per Month
- Next-Day Order Confirmations
- Next-Day SMS Confirmation
- Notable National Parks
- Overlong Support Messages
- Pallets With a Well-Formed Tracking Code
- Pivot Store Sales by Quarter
- Players Not Recruited by Coach #4
- Players Whose Coach Left the Roster
- Podcast Episodes Missing a Transcript
- Podcast Search Relevance and Weak-Hit Rate
- Poll Participation Rate
- Poorly Received Recipes
- Popular Titles Borrowed in a Month
- Power Users by Spending
- Products Below Reorder Point
- Quarterly Revenue by Category
- Rank the App Leaderboard
- Readable Book Due Dates
- Readers Who Never Checked Out a Book
- Recommendable Trails
- Recruiters Who Never Staffed Helix
- Repeat Gate Entries Within a Day
- Replies per Help-Desk Ticket
- Same-Day Ticket Resolution Rate
- Show Each Book's Shelf Code
- Sites per Region
- Soil Moisture Classification per Greenhouse
- Students and Their Dorm Rooms
- Subscriber Count per Channel
- Supplier With the Most Deliveries
- Support Ticket Resolution Histogram
- Tax Software Revenue Split
- Threads Flagged Yesterday
- Tidy Track Plays by Month
- Tidy Up Author Names
- Times Each Chef Appears on the Menu
- Tools Borrowed Only in Spring
- Top 3 Cities by Completed Trades
- Top 3 Most Profitable Drugs
- Top 3 Streamed Tracks
- Top Bakery Showdown
- Top Earning Market Stall
- Top Restaurants by Completed Order Count
- Top Viewers by Watch Hours
- Top-Day Revenue Gap Between Two Branches
- Total Pages Read per Library Member
- Total Parcel Weight per Courier
- Total Parking Minutes per Vehicle
- Total Spend per Diner
- Total Stored Capacity Per Cold Room
- Tutors Idle Through 2023
- Tweet Frequency Histogram
- Unfinished Assembly Lines
- Unfold Shift Readings
- Uninterrupted Study Sessions
- Units Dispensed per Drink
- Usernames Chosen More Than Once
- Valid Internal Handles
- Valid Message Routing Keys
- Valid Relay Teams Across Three Clubs
- Vehicles Flagged for Recall
- Volunteer Appreciation Reward
- Volunteers With All Three Certifications
- Weighted Average Rating
- Weighted Mean Order Size
- Well-Attended Fitness Sessions
Medium SQL questions 196
- 3-Day Tweet Rolling Average
- 7-Day vs 28-Day Rolling Avg Divergence
- A/B Test Sample Ratio Mismatch (SRM) Check
- Accounts Streaming From Two Devices at Once
- Ad Campaign Funnel Analysis
- Agent Resolution Rate
- Agents With a Dominant Contact Channel
- App Time Split by Age Group
- Apply Publisher Promotions to Book Prices
- At-Risk Credit Card Customers
- Average Deal Size by Market Segment
- Average Session Duration from Load/Exit Pairs
- Average Trade Amount by Segment and Month
- Average Workout Length Before and After Joining
- Bad Experience Rate for New Users
- Banner With the Best Click-Through
- Billboard Pairs Enclosing Land
- Blocks of Occupied Parking Bays
- Book Suggestions from Reading Buddies
- Borrows per Patron in 2023
- Bounce Rate per Landing Page
- Branches With Above-Average Water Flow
- Breakthrough Third Session
- Bucket Daily Rainfall
- Busiest Scan Hour per Warehouse Zone
- Busiest Subway Station
- Captain of the Biggest Squad
- Carry Forward the Thermostat Setting
- Chess Club Ladder Standings
- Chess Club Standings
- Class Reservations and Waitlist Counts
- Classify Category Nodes
- Classifying Departments in an Org Chart
- Clocked Hours from Swipe In/Out Pairs
- Closest Pair of Sensor Stations
- Coffee Cupping Leaderboard
- Cohort First-Week Return Rate
- Collaborator Pairs With No Shared Collaborator
- Combined Device Feature Flags
- Committed Gym Members
- Conversion Funnel Drop-off per Step
- Count Bottles and Cans Across Pallets
- Count Overlapping Room Bookings
- Count Workshops per Room and Track
- Courses Booked Heavily in Two Consecutive Years
- Cumulative Campaign Budget
- Cumulative Downloads per Platform
- Customers With Only Good Order Statuses
- Daily Crypto Volume and Day-over-Day Change
- Daily Net Inventory Movement
- Daily Warranty Approval Rate
- Day-1 Player Retention Rate
- Debate League Standings and Divisions
- Debut Harvest of Each Wine
- Department Top-3 Earners
- Department vs Company Pay Benchmark
- Divisive Hiking Trails
- Documentary Heavy Viewers
- Each Athlete's Best Event
- Each Reader's Favourite Genre
- Each Reader's Three Latest Loans
- Eligible Trade-In Payouts
- Employee Earns More Than Manager
- Employees Earning Above Company Average
- Esports Ladder Standings by Split
- EV Charging Spend per Vehicle
- Everyone Under the Squadron Commander
- Festival Category Wins
- First Sign-Ins by Day
- First vs Returning Customer Revenue
- Flagging Patterns in Request Lines
- Forward-Fill NULL Job Roles
- Full Product Coverage Customers
- Fully Certified Staff
- Genres Whose Tracks Echo the Genre Initial
- Grant Applicants Who Cleared Review
- Group Tenants by Shared Rent
- Hackathon Favorite With the Most Weighted Picks
- Heaviest Parcel Shipped Each Day
- Hide Trial Tickets for Paying Members
- How Often Each Host Was a Guest
- Ingredients Frequently Used Together
- Interleave Volunteers by Shift Type
- Last Crate Loaded on the Delivery Van
- Last Person to Board the Bus
- Last-Touch Attribution Revenue
- Latest Booking per Room
- Lead Climber on Each Route
- Lead Funnel Conversion by Source
- Leaderboard Shake-Up
- Listener Engagement Profile on a Music Service
- Listening Mix by Membership Tier
- Longest Gap Between Library Visits
- Longest Run of Open Parking Bays
- Longest Support Sessions per Channel
- Lopsided Recipes
- Loyalty Tier of Each Subscriber
- Match Counts Between Chess Players
- MAU Percentage Change Month-over-Month
- Member Count per Club
- Members Lifting Heavier Over Time
- Members Who Booked Yoga and Spin but Not Boxing
- Members Who Held a Pass but Never Checked In
- Members With a Quick Repeat Borrow
- Mentors With At Least Five Mentees
- Mid-Chain Mentors
- Middle-Tier Workshop Topics
- Minimum Donation Tier That Fits Each Venue
- Missing Invoice Serial Numbers
- Monthly Ad Performance by Region
- Monthly Shipments and Returns by Region
- Most Connected Co-Author
- Most Frequently Ordered Item per Store
- Most Recent Cart per Customer
- Most Versatile Studios
- Most-Voted Book of the Month
- Mutual Translation Routes
- Net Payouts After Agency Fee
- Net Profit per Trading Card
- New User 7-Day Return Rate
- Next-Day Return Rate at a Climbing Gym
- Odd and Even Page Counts per Shelving Day
- Odd and Even Sensor Readings
- Overworked Hospital Staff
- Payment Failure Rate by Currency
- Peak Visitor Day for Each Trail
- Percentile Standing of Each Runner
- Pick the Best Courier for Each Delivery Zone
- Plan Price on a Given Date
- Podcast Pairs Sharing the Most Subscribers
- Prime-Time Gym Regulars
- Products with Continuously Growing Revenue
- Promotion-Track Baristas
- Quarterly Sales Pivot by Product
- Quietly Rented Board Games
- Resolve Sensor Threshold Checks
- Riders per Ferry I
- Runner-Up Salary
- Running Sales Total by Product
- Running Total of Donations per Donor
- Running Wallet Balance
- Same-Day Rate on First Tickets
- Same-Day Repair Rate by Logged Date
- Saturday Donation Totals
- Saturday Sales by Loyalty Tier
- Scouts Who Earned Every Badge
- Second Most Expensive Book Price
- Second-Priciest Listing per Neighborhood
- Session Duration by Platform
- Session Length Bucket Histogram
- Seven-Day Ridership Trend
- Shoppers With Multiple Products in a Day
- Shrinking Insurance Policies
- Solar Panels Generating More Per Sun-Hour
- Spot a Gym Check-in Spike
- Standout Clinics
- Steadily Climbing Athletes
- Streaming Subscribers on a Hot Streak
- Subscribers With Two Streams Within Five Days
- Subscription Churn Rate by Plan
- Support Tickets Grouped Into 4-Hour Shifts
- Swap Adjacent Relay Lanes
- Tasting Score Spread
- Third Fastest Marathon Time
- Three-Day Rolling Average of Solar Output
- Three-Flower Bouquet Costs
- Tickets Filed on Weekends vs Weekdays
- Tickets Mentioning Key Words
- Tickets That Eventually Closed
- Tight Collaborations
- Top 2 Items per Category
- Top 2 Products per Category
- Top 3 Cities by Customer Count
- Top 3 Cities by Total Order Amount
- Top 3 Weekday Power Users
- Top Earning Dish per Diner
- Top Issue Tags in a Support Queue
- Top Marketing Channel by Season
- Top Percentile Return Rates by Region
- Top Reviewer and Best Episode
- Top Solar Installer per Panel Technology
- Top-Streamed Track in Each Genre
- Total Machine Run-Time in Days
- Triple Consecutive Sensor Codes
- Trusted Driver Monthly Ratings
- Tuition Collected by Each Tutor
- Two Lists, Sorted Apart
- Unassigned Locker Numbers
- User's Third Transaction
- Users Who Viewed on First Login Day
- Verified References on Each Order
- Volunteers Who Fell Short of Their Pledge
- Wallet Balances After Transfers
- Warehouses Stocking Heavy Items Too Thinly
- Water Meters Over the Monthly Cap
- Year-over-Year Revenue Growth
Hard SQL questions 103
- 3-Consecutive-Week Marketing Streak
- 30-Day Rolling Average Trading Volume
- 7-Day Active User Rolling Metric
- 7-Day Revenue Moving Average
- Always Mid-Pack Bakers
- Annual Energy Output Growth by Panel Model
- Attendees By Track
- Auto-Tagging Support Tickets
- Bake-Off Division Champions
- Branch Energy Spend vs Chain Average
- Cancellation Rate (Unbanned Users)
- Charging Session Outliers (Z-Score)
- Closed Loops in a Book-Swap Club
- Collaboration Reach of Each Researcher
- Compatible Carpool Pairs
- Confirmed or Waitlisted Webinar Seats
- Creators With Year-Over-Year Growth
- Customer Segmentation with Contact Labels
- Daily Failed-Delivery Rate
- Daily Spend by Payment Channel
- Dashboard adoption and retention cliff
- DAU/MAU Stickiness per Day
- Day-1 and Day-7 Cohort Retention
- Desk Cohesion Across Trading Sessions
- Detect Duplicate Payments
- Detect Overlapping Meetings
- Devices With the Longest Run of Daily Check-ins
- Distinction Apprentices
- Distribution of Tickets Closed per Shift
- Employee Manager Hierarchy Depth
- Every Saturday's Donation Total
- Filling a Shipping Container
- First-Touch Attribution Revenue
- Folder Tree Depth, Descendants and Rolled-Up Size
- Four-State User Lifecycle Classification
- Friend Recommendations by Mutual Friend Count
- Genres Commonly Heard by the Same Listeners
- Hire Within Budget — Seniors First
- How Many Veteran and Rookie Pilots Fit the Payroll
- Idle Forklift Shifts
- Itemize the Largest Repair Ticket
- L7 Power-User Curve
- Library Checkouts by Weekday and Genre
- Linear Multi-Touch Attribution
- Longest Consecutive Login Streak
- Longest On-Crew Relay Streak
- Longest On-Time Streak
- Longest Steady Thermostat Streak
- Machines on a Repeating Maintenance Rotation
- Machines With Quick Back-to-Back Runs
- Malformed Mesh Node Addresses
- Matching Rental Property Pairs
- Median Reading From a Frequency Table
- Median Salary by Department
- Median-Priced Listing in Each Neighborhood
- Merge Overlapping Room Bookings
- Missing Lesson Steps
- Month-over-Month Revenue % Change
- Monthly Retained Users
- Monthly Subscription Four-State Breakdown
- Most-Connected Non-Friend Pair
- Most-Mentioned Features in Reviews
- Mutual Friend Suggestions
- Next-Day Workout Retention
- Normalize Ingredient Names to Title Case
- Novelty Effect Detection Week-by-Week
- Page Recommendations via Friends' Likes
- Peak Concurrency and Total Overlap of Maintenance Windows
- Pivot Sensor Readings Into One Row Per Device
- Popular Exhibit-to-Exhibit Routes
- Product Pairs Within Price Range
- Q1 enterprise revenue concentration
- Rainwater Held by a Skyline
- Reactivated Users After Churn
- Recipe Suggestions From Connections
- Render Node Utilisation
- Render the Polynomial Filter
- Research Lab Reporting Chain Under the Director
- Returns Within 1 Year of Purchase
- Riders per Ferry II
- Roll Up Sunny and Rainy Streaks
- Same Opponent for First and Last Match of a Day
- Second Most Recent Service per Vehicle
- Session Identification via Gap Detection
- Sessions Running Concurrently
- Seven-day activation by channel
- Shifts Above the Warehouse Average
- Solar Installer Monthly Activity (2021)
- Solar Installer Three-Month Rolling Averages (2021)
- Solar Installer Working Percentage (2021)
- Stations With a Warming Streak
- Suggest Study Partners
- Sustained Busy Days at the Toll Plaza
- Title-Case Recipe Names With Hyphens
- Top Three Food Trucks Per City
- Top Three Sellers per Warehouse
- Trailing Three-Month Sales, Excluding the Latest Month
- Trial Users Who Became Buyers
- Unpivot Sensor Readings Into Tall Format
- Was the Second Supply a Preferred Vendor?
- Welch t-Statistic for A/B Test
- Which Veteran and Rookie Pilots Fit the Payroll
- Yearly Billboard Revenue per Panel