Basic SQL Query Writing

Problem Write basic SQL queries against a small schema handed to you in the round — straightforward retrieval with filters, joins, grouping, and aggregate conditions.

Schema

  • Typically 2-3 tables, e.g. customers(customer_id, name, city), orders(order_id, customer_id, product_id, amount), products(product_id, name, price)

Output

  • A result set matching the stated requirement exactly — e.g. one row per customer with their order count, or one row per product that has never been ordered

Example

  • "Find all customers who placed more than N orders" → join customers to orders, GROUP BY customer, HAVING COUNT(*) > N
  • "List products never ordered" → LEFT JOIN products to orders and keep the rows where the orders side is NULL, or use NOT EXISTS
asked …
LeaderboardSalaryAccount