SQLQuokka
Start practicing
QuestionsLearnSandboxFeaturesRoadmapFAQ
SQL Study Plan

SQL Basics: Filtering, Sorting and Limits

Every SQL interview starts here. These questions cover choosing rows with WHERE, combining conditions, handling NULLs, sorting with ORDER BY and keeping only the rows you need with LIMIT and DISTINCT.

20 questions · 9 Easy · 8 Medium · 3 Hard · about 2.8 hours · MySQL & PostgreSQL

What you'll practise

  • WHERE and AND / OR conditions
  • IN, BETWEEN and range filters
  • NULL handling
  • ORDER BY with tie-breakers
  • LIMIT and top-N queries
  • DISTINCT

Learn the concepts first

Questions in this plan

  1. Top Paid Engineers

    Show the name and salary of employees in 'Engineering' who earn more than 70000, highest first, top 3.

    Easy✓ Solved
  2. Multilingual Language Speakers

    Identify users who speak at least two distinct target languages ('English', 'Spanish', 'German') from skill profile records.

    Easy✓ Solved
  3. Users With Zero Searches

    Find registered account profiles that have never submitted a search query using an outer join.

    Easy✓ Solved
  4. Play Store: Top Rated App Categories

    Find categories with at least 3 apps rated 4.0 or higher, returning the category, app count, and average rating rounded to 2 decimals.

    Easy✓ Solved
  5. Google Maps: High-Impact Local Guides

    Find verified reviewers who submitted at least 2 photo reviews in San Francisco or Mountain View.

    Easy✓ Solved
  6. Google Drive: External Sensitive File Shares

    Audit sensitive files shared with non-Google email addresses to identify potential data exposure risks.

    Easy✓ Solved
  7. Google Cloud: Underutilized Virtual Machines

    Detect running compute instances exhibiting low CPU and memory utilization to optimize infrastructure costs.

    Easy✓ Solved
  8. YouTube: Top Video Engagement Rate

    Evaluate recently published high-traffic videos to surface those with exceptional like-to-view ratios.

    Easy✓ Solved
  9. Cities With Most Loyal Customers

    Group users by metropolitan territory and rank locations by repeat checkout count over 90 days.

    Easy✓ Solved
  10. Rank Salaries Within Department

    Assign dense rank values to employee compensations per department without skipping ranks for tied salaries.

    Medium✓ Solved
  11. Google Workspace: Storage Quota Alerts

    Calculate total Drive storage per organization and return those exceeding their quota, showing total used and excess GB.

    Medium✓ Solved
  12. Google Play: High-Value Repeat Spenders

    Identify key monetization users in target regions who executed 3+ in-app purchases totaling over $100.

    Medium✓ Solved
  13. Second Highest Salary

    Find the second highest distinct salary from the Employee table without duplicate values.

    Medium✓ Solved
  14. Nth Highest Salary

    Write a dynamic MySQL stored procedure or subquery to retrieve the Nth distinct salary ranking.

    Medium✓ Solved
  15. Amazon: Marketplace Seller Return Rate

    Identify marketplace merchants with at least 5 fulfilled orders whose customer return rate exceeds 10%.

    Medium✓ Solved
  16. Amazon: First Order Details

    Retrieve each customer's very first order, resolving date ties by selecting the lowest order_id.

    Medium✓ Solved
  17. Amazon: Best-Selling Products per Category

    Identify the top-selling product in each retail category by total units sold, returning all tied leaders using DENSE_RANK.

    Medium✓ Solved
  18. Amazon: Frequently Bought Together

    Identify product pairs purchased together in the same order at least 3 times without duplicate pairs or reflexive matches.

    Hard✓ Solved
  19. Monthly Net Revenue by Customer

    Net payments, refunds and chargebacks into the month each money movement happened.

    Hard✓ Solved
  20. Three-Month Salary Window

    Each employee's rolling three-month salary total, excluding their most recent month.

    Hard✓ Solved