Gomaa Intelligence.Data Hub
عربي

Foundations › SQL › Practice bank

Practice bank

SQL Practice Bank

20 exercises from real analyst work, three levels.

0 / 20

Easy Exercise 1 — Show Electronics products sorted by price descending: name and price.

Easy Exercise 2 — Show customers per city, most first then by city: city and n.

Easy Exercise 3 — What share of all orders is completed? Show a percentage with one decimal as completed_pct.

Easy Exercise 4 — Show cities with more than 2 customers lacking an email: city and n.

Easy Exercise 5 — Show the average price per category rounded to 2 decimals, ascending: category and avg_price.

Medium Exercise 6 — Show revenue per month in 2026 from completed orders, sorted by month: month and revenue.

Medium Exercise 7 — Show the 5 best-selling products by quantity, ties by name: name and units.

Medium Exercise 8 — Show orders per status and its share of the total with one decimal: status, n and pct.

Medium Exercise 9 — Show the number of customers who never ordered per city: city and n.

Medium Exercise 10 — Show products not sold in 2026 (they may have sold earlier): name.

Medium Exercise 11 — Show revenue and profit per category (quantity × (price − cost)): category, revenue and profit.

Medium Exercise 12 — Show average order value per city (completed orders) = city revenue ÷ its order count, 2 decimals: city and avg_order_value.

Medium Exercise 13 — Show employees paid more than their manager: name and salary.

Medium Exercise 14 — Show each department's employee count and average salary rounded to a whole number (departments with no employees still appear): department, employees and avg_salary.

Hard Exercise 15 — Show customers with 9 or more orders with first and last order dates: customer_id, first_order, last_order and n.

Hard Exercise 16 — Show each category's share of total revenue as a percentage with one decimal: category and share_pct.

Hard Exercise 17 — Show orders with more than 2 items and a total above 3000: order_id, items and total.

Hard Exercise 18 — Pivot: revenue per category (completed orders) split across 2025 and 2026 in two columns: category, y2025 and y2026.

Hard Exercise 19 — How many customers have both completed and cancelled orders? Name it n.

Hard Exercise 20 — Segment customers by total spend on completed orders: VIP if spend is 25000 or more, Regular if 8000 or more, otherwise Low. Show the customers per segment: segment and n.

Want an expert to do it for you?

Gomaa Intelligence turns your data into clear reports and decisions. Tell us your problem and we will reply.

Get your data analyzed by an expert ↗