SQL Practice Tasks

Use these tasks with any sample ecommerce or HRM database. The goal is not memorizing syntax; the goal is thinking like a tester with data.

Beginner

  1. Find all active users created in the last 30 days.
  2. List the latest 20 failed orders.
  3. Find users with missing phone numbers.

Intermediate

  1. Join orders with customers and show customer name, order status, and total amount.
  2. Find customers who never placed an order.
  3. Count failed payments by customer and show only customers with 3 or more failures.

Advanced

  1. Validate that every paid order has exactly one successful payment.
  2. Find duplicate users by email after lowercasing and trimming spaces.
  3. Design test cases for rollback when payment succeeds but invoice creation fails.

Interview Questions