SQL Interview Questions Practice

Prepare for SQL interviews by solving problems collected from real interviews at 77 companies, including Amazon, Microsoft, Meta, and others. Each problem identifies its company and covers practical SQL skills, from basic filtering to joins and aggregation. Your query runs in a real database and is automatically checked using hidden data. Problems: 172, free: 44.

Problems in this set: 172, free: 44

Start with a free problem

Interview problems

Problems found: 161

Reset filters
  • EasyFree
    PostgreSQL · ClickHouse

    Daily Transaction Volume by Banking Product

    Gazprombank is building a daily transaction volume report for its corporate banking products. Each operation has an associated client, product category, and amount in rubles.

    Gazprombank
  • EasyFree
    PostgreSQL · MySQL · ClickHouse

    Difference Between Highest and Lowest Monthly Card Issuance

    JPMorgan Chase is preparing a credit card issuance report. For each card, calculate the difference between the highest and lowest numbers of cards issued in a month. Return card_name and difference.

    JPMorgan Chase
  • EasyFree
    PostgreSQL · MySQL · ClickHouse

    Duplicate Job Listings

    LinkedIn wants to identify companies that post duplicate job listings. Find groups of listings with identical company_id, title, and description values where the group contains more than one record.

    LinkedIn
  • EasyFree
    PostgreSQL · MySQL · ClickHouse

    Laptop and Mobile Views

    The analytics team is comparing views across the device types laptop, tablet, and phone. Count laptop views separately from mobile views. Mobile devices include tablet and phone.

    New York Times
  • EasyFree
    PostgreSQL · ClickHouse

    Number of SKU Buyers on a Given Date

    At Ozon, a junior analyst is investigating sales spikes for a specific product and wants to know how many unique buyers placed an order on a given day.

    Ozon
  • EasyFree
    PostgreSQL · MySQL · ClickHouse

    Final Account Balances

    Calculate the final balance of each account from the transaction log. The transaction_type column can contain Deposit or Withdrawal. Return account_id and final_balance. Sort the result by account_id.

    PayPal
  • EasyFree
    PostgreSQL · MySQL · ClickHouse

    Top 3 Cities by Completed Trades

    Robinhood is analyzing trading activity by city. Find the three cities with the most completed trades (status = 'Completed'). Return each city name and its number of completed trades as total_orders.

    Robinhood
  • EasyFree
    PostgreSQL · ClickHouse

    Active Contract Version on March 15, 2024

    Rosbank's DDS layer stores contract history using SCD2. Each record version is valid over a right-open interval stored in the valid column, meaning the lower bound is inclusive and the upper bound is…

    Rosbank
  • EasyFree
    PostgreSQL · MySQL · ClickHouse

    Signup Confirmation on the Next Day

    TikTok is analyzing new user behavior. Find users who confirmed their email (signup_action = 'Confirmed') via SMS on the calendar day immediately after signing up, not on the signup date itself.

    TikTok
  • EasyFree
    PostgreSQL · MySQL · ClickHouse

    Apple Pay and Other Payment Amounts

    Visa is analyzing its partnership with Apple Pay. For each merchant_id, calculate the total amount of transactions made through Apple Pay as apple_pay_amount and the total amount of transactions made…

    Visa
  • EasyFree
    PostgreSQL · ClickHouse

    Price Categories Without CASE or IF

    In a Yandex Practicum mini-project involving a stationery store, you need to determine the price category of each purchased product.

    Yandex Praktikum

What you will practice

  • Translate business questions into SQL queries
  • Define what each row of the answer should represent
  • Combine filtering, joins, and aggregation in one query
  • Check duplicates, missing values, and boundary cases
  • Explain why a query answers the original question

Common mistakes

  1. 1. Counting events instead of users

    Interview problems often ask for counts of users, orders, or actions. Those are different units. When one user generates several events, counting rows can inflate the answer. Before writing SQL, define what one counted item represents and whether repeated records should contribute.

  2. 2. Ignoring ties in ranking problems

    Several users, products, or categories may share the same score. Sorting with LIMIT does not always produce the ranking logic the problem expects. Check whether the requested result is a fixed number of rows or includes all records tied at a particular rank.

  3. 3. Misreading date range boundaries

    Phrases such as during a day, last month, and after a date describe different intervals. A query may work on ordinary records but fail at the boundaries. Check whether start and end values are inclusive and whether the column contains dates or timestamps.

  4. 4. Letting joins inflate business metrics

    Joining tables can duplicate an order, payment, or user before aggregation. The final numbers may look reasonable even when they are incorrect. Identify the level of detail in each table and verify that the JOIN does not multiply the entity you intend to count or sum.

Theory and courses

Frequently asked questions

Can I practice SQL interview problems for free?

Yes. Total problems in this collection: 172, free: 44. After signing in, you can solve up to 3 new problems per day on the free plan. Premium problems remain visible in the list but require a subscription to solve.

Are solutions to the interview questions available?

Reference SQL solutions are not published. You write and submit your own query, which runs in a real database. The trainer automatically compares its output with an expected result using hidden data. Problems include hints and an AI mentor to help with your approach.

What does the company name on a problem mean?

Every problem in this collection is associated with a company where it appeared in an interview. The collection covers 77 companies. The name provides context for the question, but solving it still comes down to understanding the tables, the business requirement, and the expected output.

Is knowing JOIN and GROUP BY enough for SQL interviews?

Not entirely. This collection includes different kinds of SQL problems, including selections, joins, aggregations, and more involved data analysis. Rather than memorizing individual query patterns, practice identifying which operations a question requires and checking whether the result is logically correct.

How should I check an interview solution before submitting?

First define what one output row represents: a user, order, product, or event. Then review filters, joins, duplicates, missing values, and date boundaries. For ranking problems, consider ties. These checks can reveal logical mistakes even when the SQL executes without syntax errors.