Basic SQL interview questions
The first 17 questions from SQL 50. They test what comes up in almost every interview: filtering correctly, counting correctly, NULLs and dates. Each one has a small trap that is easy to miss under time pressure.
In short: basic interview questions rarely need more than SELECT, WHERE, GROUP BY and one JOIN. What makes them tricky is precision: integer division in a percentage, NULL in a condition, text instead of a date, counting order lines instead of orders. Once you know these traps, each question takes a few minutes.
How practice works here
Every question runs on a real database in your browser. The tables with all their rows sit above the editor. You can run your query as often as you like; Check compares the result with the model answer and then with hidden, slightly changed data. A hard-coded value shows up there.
If you want to test yourself under time pressure like in an interview, start the stopwatch above the question. It stops as soon as you solve the question and remembers your best time. The time stays in your browser and has no effect on points. The first question on this page is free, the rest are part of Premium; you can read all of them.
The 17 questions
1. Cancellation rate as a percentage
Task The kitchenware shop's management wants to know how many orders get cancelled. Show one row with orders (all orders), cancelled (orders with status 'cancelled') and rate_pct (the cancelled share as a percentage, rounded to one decimal place).
orders 122 rows, 5 columns
| order_id | customer_id | order_date | status | amount |
|---|---|---|---|---|
| 5001 | 2 | 2025-11-01 | cancelled | 93.9 |
| 5002 | 4 | 2025-11-02 | delivered | 238.8 |
| 5003 | 6 | 2025-11-08 | delivered | 14.9 |
| 5004 | 3 | 2025-11-10 | delivered | 29.9 |
| 5005 | 7 | 2025-11-11 | delivered | 44.9 |
| 5006 | 5 | 2025-11-13 | delivered | 104.7 |
| 5007 | 11 | 2025-11-16 | delivered | 17.9 |
| 5008 | 13 | 2025-11-17 | delivered | 119 |
| 5009 | 9 | 2025-11-18 | delivered | 206.8 |
| 5010 | 10 | 2025-11-20 | delivered | 758 |
| 5011 | 12 | 2025-11-23 | delivered | 44.9 |
| 5012 | 1 | 2025-11-25 | delivered | 77.8 |
| 5013 | 4 | 2025-11-27 | delivered | 149 |
| 5014 | 8 | 2025-11-28 | delivered | 39.9 |
| 5015 | 10 | 2025-12-15 | delivered | 777.9 |
| 5016 | 14 | 2025-12-16 | delivered | 55.8 |
| 5017 | 2 | 2025-12-22 | delivered | 34.9 |
| 5018 | 16 | 2025-12-22 | delivered | 79 |
| 5019 | 15 | 2025-12-29 | delivered | 22.9 |
| 5020 | 20 | 2025-12-29 | delivered | 59.8 |
| 5021 | 21 | 2025-12-30 | delivered | 379 |
| 5022 | 19 | 2025-12-31 | delivered | 114.7 |
| 5023 | 17 | 2026-01-03 | delivered | 49.8 |
| 5024 | 18 | 2026-01-08 | delivered | 79 |
| 5025 | 6 | 2026-01-14 | delivered | 44.9 |
| 5026 | 11 | 2026-01-16 | delivered | 12.9 |
| 5027 | 9 | 2026-01-17 | delivered | 49.9 |
| 5028 | 2 | 2026-01-21 | delivered | 59.9 |
| 5029 | 22 | 2026-01-24 | delivered | 49.9 |
| 5030 | 24 | 2026-01-25 | delivered | 498 |
| 5031 | 25 | 2026-02-04 | delivered | 413.9 |
| 5032 | 5 | 2026-02-05 | delivered | 34.9 |
| 5033 | 28 | 2026-02-06 | cancelled | 34.9 |
| 5034 | 26 | 2026-02-11 | delivered | 17.9 |
| 5035 | 11 | 2026-02-20 | delivered | 39.9 |
| 5036 | 21 | 2026-02-23 | delivered | 170.9 |
| 5037 | 29 | 2026-02-25 | delivered | 49.9 |
| 5038 | 27 | 2026-02-26 | delivered | 24.9 |
| 5039 | 12 | 2026-03-03 | delivered | 308 |
| 5040 | 18 | 2026-03-03 | delivered | 26.9 |
| 5041 | 15 | 2026-03-06 | delivered | 99.6 |
| 5042 | 1 | 2026-03-07 | delivered | 403.8 |
| 5043 | 31 | 2026-03-11 | delivered | 417.7 |
| 5044 | 30 | 2026-03-12 | delivered | 149 |
| 5045 | 33 | 2026-03-13 | delivered | 158 |
| 5046 | 34 | 2026-03-19 | delivered | 189 |
| 5047 | 32 | 2026-03-27 | delivered | 123.8 |
| 5048 | 35 | 2026-03-30 | delivered | 93.9 |
| 5049 | 19 | 2026-04-01 | delivered | 69.8 |
| 5050 | 2 | 2026-04-04 | cancelled | 368.9 |
| 5051 | 34 | 2026-04-06 | delivered | 47.8 |
| 5052 | 20 | 2026-04-16 | delivered | 119 |
| 5053 | 6 | 2026-04-22 | delivered | 258.7 |
| 5054 | 2 | 2026-04-23 | cancelled | 126.7 |
| 5055 | 11 | 2026-04-24 | delivered | 29.9 |
| 5056 | 36 | 2026-04-26 | delivered | 79 |
| 5057 | 37 | 2026-04-26 | cancelled | 12.9 |
| 5058 | 39 | 2026-04-27 | delivered | 117.7 |
| 5059 | 38 | 2026-04-29 | delivered | 19.9 |
| 5060 | 22 | 2026-04-30 | delivered | 59.9 |
| 5061 | 99 | 2026-05-01 | delivered | 63.7 |
| 5062 | 40 | 2026-05-04 | delivered | 158 |
| 5063 | 41 | 2026-05-05 | delivered | 378 |
| 5064 | 29 | 2026-05-14 | delivered | 228.7 |
| 5065 | 43 | 2026-05-17 | delivered | 74.7 |
| 5066 | 45 | 2026-05-25 | cancelled | 39.9 |
| 5067 | 44 | 2026-05-27 | delivered | 69.8 |
| 5068 | 46 | 2026-05-31 | delivered | 80.7 |
| 5069 | 27 | 2026-06-04 | delivered | 97.7 |
| 5070 | 31 | 2026-06-09 | delivered | 68.7 |
| 5071 | 18 | 2026-06-10 | delivered | 189 |
| 5072 | 19 | 2026-06-11 | delivered | 57.7 |
| 5073 | 35 | 2026-06-13 | delivered | 149 |
| 5074 | 47 | 2026-06-19 | delivered | 119 |
| 5075 | 49 | 2026-06-20 | delivered | 39.9 |
| 5076 | 48 | 2026-06-23 | delivered | 49.9 |
| 5077 | 42 | 2026-06-25 | delivered | 19.9 |
| 5078 | 51 | 2026-06-27 | delivered | 34.9 |
| 5079 | 39 | 2026-07-01 | delivered | 59.7 |
| 5080 | 50 | 2026-07-01 | delivered | 25.8 |
| 5081 | 45 | 2026-07-02 | delivered | 188.8 |
| 5082 | 19 | 2026-07-04 | delivered | 134.4 |
| 5083 | 53 | 2026-07-12 | delivered | 83.7 |
| 5084 | 52 | 2026-07-14 | delivered | 77.8 |
| 5085 | 38 | 2026-07-15 | delivered | 129.7 |
| 5086 | 54 | 2026-07-15 | delivered | 418.8 |
| 5087 | 46 | 2026-07-17 | delivered | 59.8 |
| 5088 | 29 | 2026-07-19 | delivered | 188.9 |
| 5089 | 36 | 2026-07-19 | delivered | 124.7 |
| 5090 | 45 | 2026-07-27 | delivered | 14.9 |
| 5091 | 41 | 2026-07-29 | delivered | 19.9 |
| 5092 | 58 | 2026-08-01 | delivered | 99.8 |
| 5093 | 56 | 2026-08-05 | delivered | 74.7 |
| 5094 | 53 | 2026-08-06 | delivered | 98.9 |
| 5095 | 59 | 2026-08-07 | delivered | 22.9 |
| 5096 | 18 | 2026-08-12 | delivered | 1157 |
| 5097 | 61 | 2026-08-16 | delivered | 44.7 |
| 5098 | 29 | 2026-08-20 | delivered | 105.7 |
| 5099 | 60 | 2026-08-24 | delivered | 307 |
| 5100 | 39 | 2026-08-27 | delivered | 103.9 |
| 5101 | 44 | 2026-08-28 | delivered | 243.8 |
| 5102 | 31 | 2026-08-31 | delivered | 128.9 |
| 5103 | 54 | 2026-08-31 | delivered | 298 |
| 5104 | 42 | 2026-09-01 | delivered | 388.9 |
| 5105 | 47 | 2026-09-01 | delivered | 124.7 |
| 5106 | 63 | 2026-09-06 | cancelled | 14.9 |
| 5107 | 64 | 2026-09-06 | delivered | 62.8 |
| 5108 | 65 | 2026-09-06 | cancelled | 208.6 |
| 5109 | 62 | 2026-09-11 | delivered | 34.9 |
| 5110 | 27 | 2026-09-18 | delivered | 29.9 |
| 5111 | 42 | 2026-09-20 | delivered | 104.7 |
| 5112 | 41 | 2026-09-21 | delivered | 24.9 |
| 5113 | 46 | 2026-09-27 | delivered | 94.6 |
| 5114 | 66 | 2026-09-28 | delivered | 29.9 |
| 5115 | 67 | 2026-10-01 | delivered | 34.9 |
| 5116 | 51 | 2026-10-07 | delivered | 69.8 |
| 5117 | 53 | 2026-10-07 | cancelled | 34.9 |
| 5118 | 70 | 2026-10-09 | delivered | 211.9 |
| 5119 | 64 | 2026-10-16 | delivered | 698 |
| 5120 | 68 | 2026-10-21 | delivered | 183.9 |
| 5121 | 69 | 2026-10-27 | shipped | 159.4 |
| 5122 | 27 | 2026-10-30 | shipped | 118.9 |
2. Signed up but never ordered
Task Marketing sends a reminder to customers who signed up but have never placed an order (not even a cancelled one). Anyone who joined very recently doesn't get it yet: the signup must be at least 30 days before the cut-off date of 31 October 2026. Show customer_id, name and signup_date for these customers, sorted by signup_date.
customers 70 rows, 6 columns
| customer_id | name | city | signup_date | channel | |
|---|---|---|---|---|---|
| 1 | Samuel Ward | samuel.ward@example.com | Austin | 2025-10-07 | Newsletter |
| 2 | Owen Robinson | owen.robinson@example.com | Denver | 2025-08-02 | Referral |
| 3 | Liam Martin | liam.martin@example.com | Chicago | 2025-09-17 | Search |
| 4 | Thomas Hughes | thomas.hughes@example.com | Bristol | 2025-09-07 | Search |
| 5 | Chloe Lewis | chloe.lewis@example.com | Bristol | 2025-09-03 | Newsletter |
| 6 | Connor Hall | connor.hall@example.com | New York | 2025-07-07 | Referral |
| 7 | Lily Robinson | lily.robinson@example.com | Glasgow | 2025-07-31 | Newsletter |
| 8 | James Thomas | james.thomas@example.com | Glasgow | 2025-07-02 | Search |
| 9 | Aisha Green | aisha.green@example.com | Chicago | 2025-07-16 | Newsletter |
| 10 | Sophia Murphy | sophia.murphy@example.com | Birmingham | 2025-08-03 | Search |
| 11 | Emily Harris | emily.harris@example.com | Leeds | 2025-11-08 | Search |
| 12 | Hannah Thomas | hannah.thomas@example.com | NULL | 2025-11-16 | Search |
| 13 | Ethan Hall | ethan.hall@example.com | Austin | 2025-11-13 | Search |
| 14 | Lucas Price | lucas.price@example.com | Leeds | 2025-11-26 | Newsletter |
| 15 | Priya Harris | priya.harris@example.com | New York | 2025-12-05 | Newsletter |
| 16 | Lucas Reed | lucas.reed@example.com | Seattle | 2025-12-01 | Search |
| 17 | Fiona Campbell | fiona.campbell@example.com | Denver | 2025-12-11 | Search |
| 18 | Ryan Wright | ryan.wright@example.com | Chicago | 2025-12-14 | Social media |
| 19 | Priya Evans | priya.evans@example.com | Denver | 2025-12-26 | Search |
| 20 | Grace Campbell | grace.campbell@example.com | Denver | 2025-12-26 | Search |
| 21 | Aisha Price | aisha.price@example.com | New York | 2025-12-30 | Referral |
| 22 | Zoe Harris | zoe.harris@example.com | New York | 2026-01-11 | Newsletter |
| 23 | Liam Brown | liam.brown@example.com | Manchester | 2026-01-15 | Newsletter |
| 24 | Olivia Taylor | olivia.taylor@example.com | Denver | 2026-02-03 | Search |
| 25 | Aisha Wilson | aisha.wilson@example.com | Austin | 2026-02-13 | Search |
| 26 | Megan Reed | megan.reed@example.com | Glasgow | 2026-01-28 | Search |
| 27 | Amelia Green | NULL | Bristol | 2026-02-04 | Search |
| 28 | Kevin Wilson | kevin.wilson@example.com | Birmingham | 2026-02-06 | Search |
| 29 | Isla Morgan | isla.morgan@example.com | London | 2026-02-11 | Search |
| 30 | Liam Hall | liam.hall@example.com | Bristol | 2026-02-22 | Referral |
| 31 | Zoe Turner | zoe.turner@example.com | Birmingham | 2026-02-24 | Search |
| 32 | Daniel Evans | daniel.evans@example.com | Chicago | 2026-03-05 | Newsletter |
| 33 | Emily Wright | emily.wright@example.com | London | 2026-03-07 | Search |
| 34 | Connor Taylor | connor.taylor@example.com | Seattle | 2026-03-11 | Search |
| 35 | Olivia Reed | olivia.reed@example.com | New York | 2026-03-24 | Social media |
| 36 | Kevin Martin | kevin.martin@example.com | Birmingham | 2026-04-01 | Referral |
| 37 | Emily Davies | emily.davies@example.com | Austin | 2026-04-09 | Search |
| 38 | Ruby Johnson | ruby.johnson@example.com | NULL | 2026-04-08 | Social media |
| 39 | Henry Campbell | henry.campbell@example.com | Glasgow | 2026-04-10 | Newsletter |
| 40 | Ethan Murphy | ethan.murphy@example.com | Bristol | 2026-04-24 | Newsletter |
| 41 | Ethan Martin | ethan.martin@example.com | Manchester | 2026-05-01 | Referral |
| 42 | Liam Campbell | liam.campbell@example.com | Austin | 2026-04-30 | Search |
| 43 | Holly Harris | holly.harris@example.com | New York | 2026-05-10 | Search |
| 44 | Aaron Smith | aaron.smith@example.com | Manchester | 2026-05-13 | Newsletter |
| 45 | Aisha Baker | aisha.baker@example.com | Denver | 2026-05-19 | Social media |
| 46 | Isla Bennett | isla.bennett@example.com | Glasgow | 2026-05-18 | Social media |
| 47 | Chloe Davies | chloe.davies@example.com | Leeds | 2026-06-05 | Newsletter |
| 48 | Thomas Robinson | thomas.robinson@example.com | Boston | 2026-06-03 | Search |
| 49 | Marcus Evans | marcus.evans@example.com | Manchester | 2026-06-15 | Newsletter |
| 50 | Oliver Wright | oliver.wright@example.com | Bristol | 2026-06-10 | Search |
| 51 | Thomas Johnson | thomas.johnson@example.com | Glasgow | 2026-06-18 | Search |
| 52 | Sophia Reed | sophia.reed@example.com | London | 2026-06-24 | Search |
| 53 | Fiona Clarke | fiona.clarke@example.com | Leeds | 2026-07-02 | Referral |
| 54 | Liam Hall | LIAM.HALL@EXAMPLE.COM | Bristol | 2026-07-08 | Search |
| 55 | Lily Thomas | lily.thomas@example.com | Boston | 2026-07-14 | Search |
| 56 | Chloe Robinson | chloe.robinson@example.com | Bristol | 2026-07-26 | Search |
| 57 | Hannah Campbell | hannah.campbell@example.com | Boston | 2026-07-20 | Social media |
| 58 | Ruby Morgan | ruby.morgan@example.com | New York | 2026-07-29 | Search |
| 59 | Sophia Smith | sophia.smith@example.com | London | 2026-07-31 | Newsletter |
| 60 | Ava Martin | ava.martin@example.com | Birmingham | 2026-08-11 | Social media |
| 61 | Jack Hall | jack.hall@example.com | NULL | 2026-08-13 | Newsletter |
| 62 | Grace Cooper | grace.cooper@example.com | Chicago | 2026-08-25 | Search |
| 63 | Connor Price | connor.price@example.com | Manchester | 2026-08-23 | Search |
| 64 | Marcus Walker | marcus.walker@example.com | Bristol | 2026-09-04 | Social media |
| 65 | Holly Brown | holly.brown@example.com | Denver | 2026-09-06 | Search |
| 66 | Priya Evans | Priya.Evans@example.com | Denver | 2026-09-19 | Search |
| 67 | Carlos Garcia | carlos.garcia@example.com | Chicago | 2026-09-19 | Social media |
| 68 | Priya Thomas | priya.thomas@example.com | Bristol | 2026-09-29 | Search |
| 69 | Mia Reed | mia.reed@example.com | Chicago | 2026-10-02 | Search |
| 70 | Marcus Turner | marcus.turner@example.com | Boston | 2026-10-04 | Newsletter |
orders 122 rows, 5 columns
| order_id | customer_id | order_date | status | amount |
|---|---|---|---|---|
| 5001 | 2 | 2025-11-01 | cancelled | 93.9 |
| 5002 | 4 | 2025-11-02 | delivered | 238.8 |
| 5003 | 6 | 2025-11-08 | delivered | 14.9 |
| 5004 | 3 | 2025-11-10 | delivered | 29.9 |
| 5005 | 7 | 2025-11-11 | delivered | 44.9 |
| 5006 | 5 | 2025-11-13 | delivered | 104.7 |
| 5007 | 11 | 2025-11-16 | delivered | 17.9 |
| 5008 | 13 | 2025-11-17 | delivered | 119 |
| 5009 | 9 | 2025-11-18 | delivered | 206.8 |
| 5010 | 10 | 2025-11-20 | delivered | 758 |
| 5011 | 12 | 2025-11-23 | delivered | 44.9 |
| 5012 | 1 | 2025-11-25 | delivered | 77.8 |
| 5013 | 4 | 2025-11-27 | delivered | 149 |
| 5014 | 8 | 2025-11-28 | delivered | 39.9 |
| 5015 | 10 | 2025-12-15 | delivered | 777.9 |
| 5016 | 14 | 2025-12-16 | delivered | 55.8 |
| 5017 | 2 | 2025-12-22 | delivered | 34.9 |
| 5018 | 16 | 2025-12-22 | delivered | 79 |
| 5019 | 15 | 2025-12-29 | delivered | 22.9 |
| 5020 | 20 | 2025-12-29 | delivered | 59.8 |
| 5021 | 21 | 2025-12-30 | delivered | 379 |
| 5022 | 19 | 2025-12-31 | delivered | 114.7 |
| 5023 | 17 | 2026-01-03 | delivered | 49.8 |
| 5024 | 18 | 2026-01-08 | delivered | 79 |
| 5025 | 6 | 2026-01-14 | delivered | 44.9 |
| 5026 | 11 | 2026-01-16 | delivered | 12.9 |
| 5027 | 9 | 2026-01-17 | delivered | 49.9 |
| 5028 | 2 | 2026-01-21 | delivered | 59.9 |
| 5029 | 22 | 2026-01-24 | delivered | 49.9 |
| 5030 | 24 | 2026-01-25 | delivered | 498 |
| 5031 | 25 | 2026-02-04 | delivered | 413.9 |
| 5032 | 5 | 2026-02-05 | delivered | 34.9 |
| 5033 | 28 | 2026-02-06 | cancelled | 34.9 |
| 5034 | 26 | 2026-02-11 | delivered | 17.9 |
| 5035 | 11 | 2026-02-20 | delivered | 39.9 |
| 5036 | 21 | 2026-02-23 | delivered | 170.9 |
| 5037 | 29 | 2026-02-25 | delivered | 49.9 |
| 5038 | 27 | 2026-02-26 | delivered | 24.9 |
| 5039 | 12 | 2026-03-03 | delivered | 308 |
| 5040 | 18 | 2026-03-03 | delivered | 26.9 |
| 5041 | 15 | 2026-03-06 | delivered | 99.6 |
| 5042 | 1 | 2026-03-07 | delivered | 403.8 |
| 5043 | 31 | 2026-03-11 | delivered | 417.7 |
| 5044 | 30 | 2026-03-12 | delivered | 149 |
| 5045 | 33 | 2026-03-13 | delivered | 158 |
| 5046 | 34 | 2026-03-19 | delivered | 189 |
| 5047 | 32 | 2026-03-27 | delivered | 123.8 |
| 5048 | 35 | 2026-03-30 | delivered | 93.9 |
| 5049 | 19 | 2026-04-01 | delivered | 69.8 |
| 5050 | 2 | 2026-04-04 | cancelled | 368.9 |
| 5051 | 34 | 2026-04-06 | delivered | 47.8 |
| 5052 | 20 | 2026-04-16 | delivered | 119 |
| 5053 | 6 | 2026-04-22 | delivered | 258.7 |
| 5054 | 2 | 2026-04-23 | cancelled | 126.7 |
| 5055 | 11 | 2026-04-24 | delivered | 29.9 |
| 5056 | 36 | 2026-04-26 | delivered | 79 |
| 5057 | 37 | 2026-04-26 | cancelled | 12.9 |
| 5058 | 39 | 2026-04-27 | delivered | 117.7 |
| 5059 | 38 | 2026-04-29 | delivered | 19.9 |
| 5060 | 22 | 2026-04-30 | delivered | 59.9 |
| 5061 | 99 | 2026-05-01 | delivered | 63.7 |
| 5062 | 40 | 2026-05-04 | delivered | 158 |
| 5063 | 41 | 2026-05-05 | delivered | 378 |
| 5064 | 29 | 2026-05-14 | delivered | 228.7 |
| 5065 | 43 | 2026-05-17 | delivered | 74.7 |
| 5066 | 45 | 2026-05-25 | cancelled | 39.9 |
| 5067 | 44 | 2026-05-27 | delivered | 69.8 |
| 5068 | 46 | 2026-05-31 | delivered | 80.7 |
| 5069 | 27 | 2026-06-04 | delivered | 97.7 |
| 5070 | 31 | 2026-06-09 | delivered | 68.7 |
| 5071 | 18 | 2026-06-10 | delivered | 189 |
| 5072 | 19 | 2026-06-11 | delivered | 57.7 |
| 5073 | 35 | 2026-06-13 | delivered | 149 |
| 5074 | 47 | 2026-06-19 | delivered | 119 |
| 5075 | 49 | 2026-06-20 | delivered | 39.9 |
| 5076 | 48 | 2026-06-23 | delivered | 49.9 |
| 5077 | 42 | 2026-06-25 | delivered | 19.9 |
| 5078 | 51 | 2026-06-27 | delivered | 34.9 |
| 5079 | 39 | 2026-07-01 | delivered | 59.7 |
| 5080 | 50 | 2026-07-01 | delivered | 25.8 |
| 5081 | 45 | 2026-07-02 | delivered | 188.8 |
| 5082 | 19 | 2026-07-04 | delivered | 134.4 |
| 5083 | 53 | 2026-07-12 | delivered | 83.7 |
| 5084 | 52 | 2026-07-14 | delivered | 77.8 |
| 5085 | 38 | 2026-07-15 | delivered | 129.7 |
| 5086 | 54 | 2026-07-15 | delivered | 418.8 |
| 5087 | 46 | 2026-07-17 | delivered | 59.8 |
| 5088 | 29 | 2026-07-19 | delivered | 188.9 |
| 5089 | 36 | 2026-07-19 | delivered | 124.7 |
| 5090 | 45 | 2026-07-27 | delivered | 14.9 |
| 5091 | 41 | 2026-07-29 | delivered | 19.9 |
| 5092 | 58 | 2026-08-01 | delivered | 99.8 |
| 5093 | 56 | 2026-08-05 | delivered | 74.7 |
| 5094 | 53 | 2026-08-06 | delivered | 98.9 |
| 5095 | 59 | 2026-08-07 | delivered | 22.9 |
| 5096 | 18 | 2026-08-12 | delivered | 1157 |
| 5097 | 61 | 2026-08-16 | delivered | 44.7 |
| 5098 | 29 | 2026-08-20 | delivered | 105.7 |
| 5099 | 60 | 2026-08-24 | delivered | 307 |
| 5100 | 39 | 2026-08-27 | delivered | 103.9 |
| 5101 | 44 | 2026-08-28 | delivered | 243.8 |
| 5102 | 31 | 2026-08-31 | delivered | 128.9 |
| 5103 | 54 | 2026-08-31 | delivered | 298 |
| 5104 | 42 | 2026-09-01 | delivered | 388.9 |
| 5105 | 47 | 2026-09-01 | delivered | 124.7 |
| 5106 | 63 | 2026-09-06 | cancelled | 14.9 |
| 5107 | 64 | 2026-09-06 | delivered | 62.8 |
| 5108 | 65 | 2026-09-06 | cancelled | 208.6 |
| 5109 | 62 | 2026-09-11 | delivered | 34.9 |
| 5110 | 27 | 2026-09-18 | delivered | 29.9 |
| 5111 | 42 | 2026-09-20 | delivered | 104.7 |
| 5112 | 41 | 2026-09-21 | delivered | 24.9 |
| 5113 | 46 | 2026-09-27 | delivered | 94.6 |
| 5114 | 66 | 2026-09-28 | delivered | 29.9 |
| 5115 | 67 | 2026-10-01 | delivered | 34.9 |
| 5116 | 51 | 2026-10-07 | delivered | 69.8 |
| 5117 | 53 | 2026-10-07 | cancelled | 34.9 |
| 5118 | 70 | 2026-10-09 | delivered | 211.9 |
| 5119 | 64 | 2026-10-16 | delivered | 698 |
| 5120 | 68 | 2026-10-21 | delivered | 183.9 |
| 5121 | 69 | 2026-10-27 | shipped | 159.4 |
| 5122 | 27 | 2026-10-30 | shipped | 118.9 |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
3. Overdue invoices with no payment
Task The cut-off date is 30 June 2026. Accounts receivable wants to call the customers who haven't paid anything at all first. Show every invoice whose due_date is before the cut-off and that has no payment whatsoever: invoice_id, customer, due_date and amount, oldest due date first.
invoices 60 rows, 5 columns
| invoice_id | customer | invoice_date | due_date | amount |
|---|---|---|---|---|
| 26001 | Northgate Cycles Ltd | 2026-01-03 | 2026-02-02 | 26959.83 |
| 26002 | Riverside Bike Co. | 2026-01-06 | 2026-02-05 | 14721.94 |
| 26003 | Hillcrest Cycle Shop | 2026-01-08 | 2026-02-07 | 16992.65 |
| 26004 | Pedal Point Inc. | 2026-01-12 | 2026-02-11 | 23417.22 |
| 26005 | Urban Wheels Online | 2026-01-15 | 2026-03-16 | 28124.62 |
| 26006 | Summit Outdoor Supply | 2026-01-17 | 2026-02-16 | 20273.54 |
| 26007 | Coastline Cycles | 2026-01-21 | 2026-02-20 | 12687.37 |
| 26008 | Greenway Bikes | 2026-01-23 | 2026-02-22 | 11730.56 |
| 26009 | Two Wheel Depot | 2026-01-26 | 2026-02-25 | 19622.5 |
| 26010 | Maple Street Cycles | 2026-01-29 | 2026-02-12 | 15772.49 |
| 26011 | Northgate Cycles Ltd | 2026-02-03 | 2026-03-05 | 34472.71 |
| 26012 | Riverside Bike Co. | 2026-02-05 | 2026-03-07 | 21466.08 |
| 26013 | Hillcrest Cycle Shop | 2026-02-09 | 2026-03-11 | 20975.08 |
| 26014 | Pedal Point Inc. | 2026-02-12 | 2026-03-14 | 30082.56 |
| 26015 | Urban Wheels Online | 2026-02-14 | 2026-04-15 | 40785.91 |
| 26016 | Summit Outdoor Supply | 2026-02-18 | 2026-03-20 | 24787.09 |
| 26017 | Coastline Cycles | 2026-02-21 | 2026-03-23 | 16231.53 |
| 26018 | Greenway Bikes | 2026-02-24 | 2026-03-26 | 14692.65 |
| 26019 | Two Wheel Depot | 2026-02-26 | 2026-03-28 | 26205.7 |
| 26020 | Maple Street Cycles | 2026-02-26 | 2026-03-12 | 19640.44 |
| 26021 | Northgate Cycles Ltd | 2026-03-03 | 2026-04-02 | 54429.19 |
| 26022 | Riverside Bike Co. | 2026-03-06 | 2026-04-05 | 32466.62 |
| 26023 | Hillcrest Cycle Shop | 2026-03-08 | 2026-04-07 | 34701.33 |
| 26024 | Pedal Point Inc. | 2026-03-11 | 2026-04-10 | 52082.83 |
| 26025 | Urban Wheels Online | 2026-03-14 | 2026-05-13 | 59991.26 |
| 26026 | Summit Outdoor Supply | 2026-03-17 | 2026-04-16 | 37796.33 |
| 26027 | Coastline Cycles | 2026-03-20 | 2026-04-19 | 24397.37 |
| 26028 | Greenway Bikes | 2026-03-23 | 2026-04-22 | 21785.83 |
| 26029 | Two Wheel Depot | 2026-03-27 | 2026-04-26 | 39812.27 |
| 26030 | Maple Street Cycles | 2026-03-29 | 2026-04-12 | 18452.9 |
| 26031 | Northgate Cycles Ltd | 2026-04-02 | 2026-05-02 | 59320 |
| 26032 | Riverside Bike Co. | 2026-04-06 | 2026-05-06 | 37402.19 |
| 26033 | Hillcrest Cycle Shop | 2026-04-08 | 2026-05-08 | 42329.35 |
| 26034 | Pedal Point Inc. | 2026-04-11 | 2026-05-11 | 61184.01 |
| 26035 | Urban Wheels Online | 2026-04-14 | 2026-06-13 | 75122.1 |
| 26036 | Summit Outdoor Supply | 2026-04-18 | 2026-05-18 | 42952.05 |
| 26037 | Coastline Cycles | 2026-04-20 | 2026-05-20 | 29968.46 |
| 26038 | Greenway Bikes | 2026-04-24 | 2026-05-24 | 25966.97 |
| 26039 | Two Wheel Depot | 2026-04-26 | 2026-05-26 | 50138.68 |
| 26040 | Maple Street Cycles | 2026-04-28 | 2026-05-12 | 27754.11 |
| 26041 | Northgate Cycles Ltd | 2026-05-03 | 2026-06-02 | 65530.8 |
| 26042 | Riverside Bike Co. | 2026-05-06 | 2026-06-05 | 37631.02 |
| 26043 | Hillcrest Cycle Shop | 2026-05-08 | 2026-06-07 | 41637.92 |
| 26044 | Pedal Point Inc. | 2026-05-11 | 2026-06-10 | 57840.47 |
| 26045 | Urban Wheels Online | 2026-05-14 | 2026-07-13 | 68239.27 |
| 26046 | Summit Outdoor Supply | 2026-05-17 | 2026-06-16 | 44576.3 |
| 26047 | Coastline Cycles | 2026-05-21 | 2026-06-20 | 28255.84 |
| 26048 | Greenway Bikes | 2026-05-24 | 2026-06-23 | 25800.16 |
| 26049 | Two Wheel Depot | 2026-05-26 | 2026-06-25 | 46653.8 |
| 26050 | Maple Street Cycles | 2026-05-29 | 2026-06-12 | 21711 |
| 26051 | Northgate Cycles Ltd | 2026-06-03 | 2026-07-03 | 48415.21 |
| 26052 | Riverside Bike Co. | 2026-06-06 | 2026-07-06 | 27191.07 |
| 26053 | Hillcrest Cycle Shop | 2026-06-09 | 2026-07-09 | 32156.21 |
| 26054 | Pedal Point Inc. | 2026-06-12 | 2026-07-12 | 46139.99 |
| 26055 | Urban Wheels Online | 2026-06-30 | 2026-08-29 | 55652 |
| 26056 | Summit Outdoor Supply | 2026-06-17 | 2026-07-17 | 37295.37 |
| 26057 | Coastline Cycles | 2026-06-20 | 2026-07-20 | 26031.62 |
| 26058 | Greenway Bikes | 2026-06-23 | 2026-07-23 | 21187.55 |
| 26059 | Two Wheel Depot | 2026-06-27 | 2026-07-27 | 41200.86 |
| 26060 | Maple Street Cycles | 2026-06-28 | 2026-07-12 | 14292.64 |
payments 48 rows, 4 columns
| payment_id | invoice_id | payment_date | amount |
|---|---|---|---|
| 1 | 26001 | 2026-01-31 | 26959.83 |
| 2 | 26002 | 2026-01-31 | 14721.94 |
| 3 | 26003 | 2026-02-02 | 16992.65 |
| 4 | 26004 | 2026-02-08 | 23417.22 |
| 5 | 26010 | 2026-02-09 | 15772.49 |
| 6 | 26008 | 2026-02-19 | 11730.56 |
| 7 | 26009 | 2026-02-25 | 9800 |
| 8 | 26011 | 2026-03-03 | 34472.71 |
| 9 | 26012 | 2026-03-07 | 21466.08 |
| 10 | 26013 | 2026-03-09 | 20975.08 |
| 11 | 26020 | 2026-03-09 | 19640.44 |
| 12 | 26014 | 2026-03-11 | 30082.56 |
| 13 | 26007 | 2026-03-13 | 12687.37 |
| 14 | 26005 | 2026-03-16 | 28124.62 |
| 15 | 26006 | 2026-03-16 | 20273.54 |
| 16 | 26009 | 2026-03-27 | 9822.5 |
| 17 | 26019 | 2026-03-28 | 13100 |
| 18 | 26021 | 2026-03-28 | 54429.19 |
| 19 | 26022 | 2026-03-30 | 32466.62 |
| 20 | 26023 | 2026-04-05 | 34701.33 |
| 21 | 26024 | 2026-04-05 | 52082.83 |
| 22 | 26030 | 2026-04-09 | 18452.9 |
| 23 | 26015 | 2026-04-10 | 40785.91 |
| 24 | 26017 | 2026-04-17 | 10000 |
| 25 | 26028 | 2026-04-22 | 21785.83 |
| 26 | 26016 | 2026-04-25 | 24787.09 |
| 27 | 26029 | 2026-04-26 | 19900 |
| 28 | 26019 | 2026-04-27 | 13105.7 |
| 29 | 26031 | 2026-05-01 | 59320 |
| 30 | 26032 | 2026-05-05 | 37402.19 |
| 31 | 26033 | 2026-05-05 | 42329.35 |
| 32 | 26034 | 2026-05-06 | 61184.01 |
| 33 | 26040 | 2026-05-10 | 27754.11 |
| 34 | 26025 | 2026-05-11 | 59991.26 |
| 35 | 26026 | 2026-05-11 | 37796.33 |
| 36 | 26038 | 2026-05-24 | 25966.97 |
| 37 | 26029 | 2026-05-26 | 19912.27 |
| 38 | 26039 | 2026-05-26 | 25000 |
| 39 | 26041 | 2026-06-01 | 65530.8 |
| 40 | 26043 | 2026-06-02 | 41637.92 |
| 41 | 26042 | 2026-06-05 | 37631.02 |
| 42 | 26050 | 2026-06-08 | 21711 |
| 43 | 26044 | 2026-06-09 | 57840.47 |
| 44 | 26035 | 2026-06-13 | 75122.1 |
| 45 | 26048 | 2026-06-22 | 25800.16 |
| 46 | 26036 | 2026-06-23 | 42952.05 |
| 47 | 26039 | 2026-06-25 | 25138.68 |
| 48 | 26049 | 2026-06-25 | 23300 |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
4. Payments imported twice
Task When the bank statements were imported, some payments came in twice or three times, each copy with a new payment_id. A payment counts as a duplicate if invoice_id, payment_date and amount are the same. Part payments on the same invoice on different days are not duplicates. For every payment that appears more than once, show invoice_id, payment_date, amount and copies (how many times it appears).
payments 52 rows, 4 columns
| payment_id | invoice_id | payment_date | amount |
|---|---|---|---|
| 1 | 26001 | 2026-01-31 | 26959.83 |
| 2 | 26002 | 2026-01-31 | 14721.94 |
| 3 | 26003 | 2026-02-02 | 16992.65 |
| 4 | 26004 | 2026-02-08 | 23417.22 |
| 5 | 26010 | 2026-02-09 | 15772.49 |
| 6 | 26008 | 2026-02-19 | 11730.56 |
| 7 | 26009 | 2026-02-25 | 9800 |
| 8 | 26011 | 2026-03-03 | 34472.71 |
| 9 | 26012 | 2026-03-07 | 21466.08 |
| 10 | 26013 | 2026-03-09 | 20975.08 |
| 11 | 26020 | 2026-03-09 | 19640.44 |
| 12 | 26014 | 2026-03-11 | 30082.56 |
| 13 | 26007 | 2026-03-13 | 12687.37 |
| 14 | 26005 | 2026-03-16 | 28124.62 |
| 15 | 26006 | 2026-03-16 | 20273.54 |
| 16 | 26009 | 2026-03-27 | 9822.5 |
| 17 | 26019 | 2026-03-28 | 13100 |
| 18 | 26021 | 2026-03-28 | 54429.19 |
| 19 | 26022 | 2026-03-30 | 32466.62 |
| 20 | 26023 | 2026-04-05 | 34701.33 |
| 21 | 26024 | 2026-04-05 | 52082.83 |
| 22 | 26030 | 2026-04-09 | 18452.9 |
| 23 | 26015 | 2026-04-10 | 40785.91 |
| 24 | 26017 | 2026-04-17 | 10000 |
| 25 | 26028 | 2026-04-22 | 21785.83 |
| 26 | 26016 | 2026-04-25 | 24787.09 |
| 27 | 26029 | 2026-04-26 | 19900 |
| 28 | 26019 | 2026-04-27 | 13105.7 |
| 29 | 26031 | 2026-05-01 | 59320 |
| 30 | 26032 | 2026-05-05 | 37402.19 |
| 31 | 26033 | 2026-05-05 | 42329.35 |
| 32 | 26034 | 2026-05-06 | 61184.01 |
| 33 | 26040 | 2026-05-10 | 27754.11 |
| 34 | 26025 | 2026-05-11 | 59991.26 |
| 35 | 26026 | 2026-05-11 | 37796.33 |
| 36 | 26038 | 2026-05-24 | 25966.97 |
| 37 | 26029 | 2026-05-26 | 19912.27 |
| 38 | 26039 | 2026-05-26 | 25000 |
| 39 | 26041 | 2026-06-01 | 65530.8 |
| 40 | 26043 | 2026-06-02 | 41637.92 |
| 41 | 26042 | 2026-06-05 | 37631.02 |
| 42 | 26050 | 2026-06-08 | 21711 |
| 43 | 26044 | 2026-06-09 | 57840.47 |
| 44 | 26035 | 2026-06-13 | 75122.1 |
| 45 | 26048 | 2026-06-22 | 25800.16 |
| 46 | 26036 | 2026-06-23 | 42952.05 |
| 47 | 26039 | 2026-06-25 | 25138.68 |
| 48 | 26049 | 2026-06-25 | 23300 |
| 101 | 26031 | 2026-05-01 | 59320 |
| 102 | 26039 | 2026-05-26 | 25000 |
| 103 | 26039 | 2026-05-26 | 25000 |
| 104 | 26006 | 2026-03-16 | 20273.54 |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
5. Who doesn't report to Tom Bradley?
Task For a leadership survey, everyone who does not report directly to Tom Bradley (employee_id 2) should get the questionnaire. The managing director, who has nobody above her, is explicitly included. Show employee_id, first_name, last_name and manager_id, sorted by employee_id.
employees 10 rows, 7 columns
| employee_id | first_name | last_name | department | salary | hire_date | manager_id |
|---|---|---|---|---|---|---|
| 1 | Karen | Mitchell | Management | 93600 | 2018-01-02 | NULL |
| 2 | Tom | Bradley | Sales | 62400 | 2019-04-01 | 1 |
| 3 | Julia | Reyes | Sales | 46800 | 2021-06-15 | 2 |
| 4 | Marcus | Allen | Sales | 49200 | 2020-09-01 | 2 |
| 5 | Sarah | Long | Warehouse | 39600 | 2022-02-01 | 1 |
| 6 | Felix | Turner | Warehouse | 35400 | 2024-03-18 | 5 |
| 7 | Nina | Cooper | Accounting | 52800 | 2019-10-01 | 1 |
| 8 | David | Ross | Customer service | 38400 | 2023-05-02 | 2 |
| 9 | Laura | Hughes | Customer service | NULL | 2025-09-01 | 2 |
| 10 | Paul | Ward | Accounting | 43200 | 2022-11-14 | 7 |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
6. Who is still on probation?
Task The probationary period lasts six months from the hire date. Who is on probation on the reference date of 15 February 2026? That means people who have already started by that date and whose probation ends after it. Show first_name, last_name, hire_date and probation_end (hire date plus six months, as a YYYY-MM-DD date).
employees 12 rows, 7 columns
| employee_id | first_name | last_name | department | salary | hire_date | manager_id |
|---|---|---|---|---|---|---|
| 1 | Karen | Mitchell | Management | 93600 | 2018-01-02 | NULL |
| 2 | Tom | Bradley | Sales | 62400 | 2019-04-01 | 1 |
| 3 | Julia | Reyes | Sales | 46800 | 2021-06-15 | 2 |
| 4 | Marcus | Allen | Sales | 49200 | 2020-09-01 | 2 |
| 5 | Sarah | Long | Warehouse | 39600 | 2022-02-01 | 1 |
| 6 | Felix | Turner | Warehouse | 35400 | 2024-03-18 | 5 |
| 7 | Nina | Cooper | Accounting | 52800 | 2019-10-01 | 1 |
| 8 | David | Ross | Customer service | 38400 | 2023-05-02 | 2 |
| 9 | Laura | Hughes | Customer service | NULL | 2025-09-01 | 2 |
| 10 | Paul | Ward | Accounting | 43200 | 2022-11-14 | 7 |
| 12 | Lily | Grant | Warehouse | 36000 | 2026-03-01 | 5 |
| 13 | Ben | Carter | Customer service | 37200 | 2025-10-15 | 2 |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
7. Campaigns that ran in October
Task For the October 2026 report, marketing needs every campaign that ran for at least one day that month, even if it started earlier or ends later. Show name, channel, start_date and end_date, sorted by start_date, then by name for equal start dates.
campaigns 14 rows, 6 columns
| campaign_id | name | channel | start_date | end_date | cost |
|---|---|---|---|---|---|
| 1 | Paid search H1 2025 | Paid Search | 2025-01-01 | 2025-06-30 | 120 |
| 2 | Paid social spring 2025 | Paid Social | 2025-03-01 | 2025-05-31 | 160 |
| 3 | Email newsletter (ongoing) | 2025-01-01 | 2026-12-31 | 360 | |
| 4 | Affiliate program sports blogs | Affiliate | 2025-01-01 | 2026-12-31 | 240 |
| 5 | Paid search H2 2025 | Paid Search | 2025-07-01 | 2025-12-31 | 420 |
| 6 | Paid social summer 2025 | Paid Social | 2025-06-15 | 2025-08-31 | 180 |
| 7 | Email Black Friday week 2025 | 2025-11-24 | 2025-12-01 | 40 | |
| 8 | Paid social Black Friday week 2025 | Paid Social | 2025-11-20 | 2025-12-01 | 230 |
| 9 | Paid search H1 2026 | Paid Search | 2026-01-01 | 2026-06-30 | 450 |
| 10 | Paid social fitness January 2026 | Paid Social | 2026-01-02 | 2026-01-31 | 150 |
| 11 | Email spring sale 2026 | 2026-03-02 | 2026-03-31 | 40 | |
| 12 | Paid search H2 2026 | Paid Search | 2026-07-01 | 2026-12-31 | 380 |
| 13 | Paid social Sep/Oct 2026 | Paid Social | 2026-09-15 | 2026-10-31 | 220 |
| 14 | Paid social video test | Paid Social | 2026-05-04 | 2026-05-24 | 120 |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
8. Orders at the weekend
Task Is weekend customer service worth it? For all orders that aren't cancelled, show two rows: day_type ('Weekend' for Saturday and Sunday, otherwise 'Weekday'), orders and revenue (sum of amount, rounded to 2 decimal places).
orders 122 rows, 5 columns
| order_id | customer_id | order_date | status | amount |
|---|---|---|---|---|
| 5001 | 2 | 2025-11-01 | cancelled | 93.9 |
| 5002 | 4 | 2025-11-02 | delivered | 238.8 |
| 5003 | 6 | 2025-11-08 | delivered | 14.9 |
| 5004 | 3 | 2025-11-10 | delivered | 29.9 |
| 5005 | 7 | 2025-11-11 | delivered | 44.9 |
| 5006 | 5 | 2025-11-13 | delivered | 104.7 |
| 5007 | 11 | 2025-11-16 | delivered | 17.9 |
| 5008 | 13 | 2025-11-17 | delivered | 119 |
| 5009 | 9 | 2025-11-18 | delivered | 206.8 |
| 5010 | 10 | 2025-11-20 | delivered | 758 |
| 5011 | 12 | 2025-11-23 | delivered | 44.9 |
| 5012 | 1 | 2025-11-25 | delivered | 77.8 |
| 5013 | 4 | 2025-11-27 | delivered | 149 |
| 5014 | 8 | 2025-11-28 | delivered | 39.9 |
| 5015 | 10 | 2025-12-15 | delivered | 777.9 |
| 5016 | 14 | 2025-12-16 | delivered | 55.8 |
| 5017 | 2 | 2025-12-22 | delivered | 34.9 |
| 5018 | 16 | 2025-12-22 | delivered | 79 |
| 5019 | 15 | 2025-12-29 | delivered | 22.9 |
| 5020 | 20 | 2025-12-29 | delivered | 59.8 |
| 5021 | 21 | 2025-12-30 | delivered | 379 |
| 5022 | 19 | 2025-12-31 | delivered | 114.7 |
| 5023 | 17 | 2026-01-03 | delivered | 49.8 |
| 5024 | 18 | 2026-01-08 | delivered | 79 |
| 5025 | 6 | 2026-01-14 | delivered | 44.9 |
| 5026 | 11 | 2026-01-16 | delivered | 12.9 |
| 5027 | 9 | 2026-01-17 | delivered | 49.9 |
| 5028 | 2 | 2026-01-21 | delivered | 59.9 |
| 5029 | 22 | 2026-01-24 | delivered | 49.9 |
| 5030 | 24 | 2026-01-25 | delivered | 498 |
| 5031 | 25 | 2026-02-04 | delivered | 413.9 |
| 5032 | 5 | 2026-02-05 | delivered | 34.9 |
| 5033 | 28 | 2026-02-06 | cancelled | 34.9 |
| 5034 | 26 | 2026-02-11 | delivered | 17.9 |
| 5035 | 11 | 2026-02-20 | delivered | 39.9 |
| 5036 | 21 | 2026-02-23 | delivered | 170.9 |
| 5037 | 29 | 2026-02-25 | delivered | 49.9 |
| 5038 | 27 | 2026-02-26 | delivered | 24.9 |
| 5039 | 12 | 2026-03-03 | delivered | 308 |
| 5040 | 18 | 2026-03-03 | delivered | 26.9 |
| 5041 | 15 | 2026-03-06 | delivered | 99.6 |
| 5042 | 1 | 2026-03-07 | delivered | 403.8 |
| 5043 | 31 | 2026-03-11 | delivered | 417.7 |
| 5044 | 30 | 2026-03-12 | delivered | 149 |
| 5045 | 33 | 2026-03-13 | delivered | 158 |
| 5046 | 34 | 2026-03-19 | delivered | 189 |
| 5047 | 32 | 2026-03-27 | delivered | 123.8 |
| 5048 | 35 | 2026-03-30 | delivered | 93.9 |
| 5049 | 19 | 2026-04-01 | delivered | 69.8 |
| 5050 | 2 | 2026-04-04 | cancelled | 368.9 |
| 5051 | 34 | 2026-04-06 | delivered | 47.8 |
| 5052 | 20 | 2026-04-16 | delivered | 119 |
| 5053 | 6 | 2026-04-22 | delivered | 258.7 |
| 5054 | 2 | 2026-04-23 | cancelled | 126.7 |
| 5055 | 11 | 2026-04-24 | delivered | 29.9 |
| 5056 | 36 | 2026-04-26 | delivered | 79 |
| 5057 | 37 | 2026-04-26 | cancelled | 12.9 |
| 5058 | 39 | 2026-04-27 | delivered | 117.7 |
| 5059 | 38 | 2026-04-29 | delivered | 19.9 |
| 5060 | 22 | 2026-04-30 | delivered | 59.9 |
| 5061 | 99 | 2026-05-01 | delivered | 63.7 |
| 5062 | 40 | 2026-05-04 | delivered | 158 |
| 5063 | 41 | 2026-05-05 | delivered | 378 |
| 5064 | 29 | 2026-05-14 | delivered | 228.7 |
| 5065 | 43 | 2026-05-17 | delivered | 74.7 |
| 5066 | 45 | 2026-05-25 | cancelled | 39.9 |
| 5067 | 44 | 2026-05-27 | delivered | 69.8 |
| 5068 | 46 | 2026-05-31 | delivered | 80.7 |
| 5069 | 27 | 2026-06-04 | delivered | 97.7 |
| 5070 | 31 | 2026-06-09 | delivered | 68.7 |
| 5071 | 18 | 2026-06-10 | delivered | 189 |
| 5072 | 19 | 2026-06-11 | delivered | 57.7 |
| 5073 | 35 | 2026-06-13 | delivered | 149 |
| 5074 | 47 | 2026-06-19 | delivered | 119 |
| 5075 | 49 | 2026-06-20 | delivered | 39.9 |
| 5076 | 48 | 2026-06-23 | delivered | 49.9 |
| 5077 | 42 | 2026-06-25 | delivered | 19.9 |
| 5078 | 51 | 2026-06-27 | delivered | 34.9 |
| 5079 | 39 | 2026-07-01 | delivered | 59.7 |
| 5080 | 50 | 2026-07-01 | delivered | 25.8 |
| 5081 | 45 | 2026-07-02 | delivered | 188.8 |
| 5082 | 19 | 2026-07-04 | delivered | 134.4 |
| 5083 | 53 | 2026-07-12 | delivered | 83.7 |
| 5084 | 52 | 2026-07-14 | delivered | 77.8 |
| 5085 | 38 | 2026-07-15 | delivered | 129.7 |
| 5086 | 54 | 2026-07-15 | delivered | 418.8 |
| 5087 | 46 | 2026-07-17 | delivered | 59.8 |
| 5088 | 29 | 2026-07-19 | delivered | 188.9 |
| 5089 | 36 | 2026-07-19 | delivered | 124.7 |
| 5090 | 45 | 2026-07-27 | delivered | 14.9 |
| 5091 | 41 | 2026-07-29 | delivered | 19.9 |
| 5092 | 58 | 2026-08-01 | delivered | 99.8 |
| 5093 | 56 | 2026-08-05 | delivered | 74.7 |
| 5094 | 53 | 2026-08-06 | delivered | 98.9 |
| 5095 | 59 | 2026-08-07 | delivered | 22.9 |
| 5096 | 18 | 2026-08-12 | delivered | 1157 |
| 5097 | 61 | 2026-08-16 | delivered | 44.7 |
| 5098 | 29 | 2026-08-20 | delivered | 105.7 |
| 5099 | 60 | 2026-08-24 | delivered | 307 |
| 5100 | 39 | 2026-08-27 | delivered | 103.9 |
| 5101 | 44 | 2026-08-28 | delivered | 243.8 |
| 5102 | 31 | 2026-08-31 | delivered | 128.9 |
| 5103 | 54 | 2026-08-31 | delivered | 298 |
| 5104 | 42 | 2026-09-01 | delivered | 388.9 |
| 5105 | 47 | 2026-09-01 | delivered | 124.7 |
| 5106 | 63 | 2026-09-06 | cancelled | 14.9 |
| 5107 | 64 | 2026-09-06 | delivered | 62.8 |
| 5108 | 65 | 2026-09-06 | cancelled | 208.6 |
| 5109 | 62 | 2026-09-11 | delivered | 34.9 |
| 5110 | 27 | 2026-09-18 | delivered | 29.9 |
| 5111 | 42 | 2026-09-20 | delivered | 104.7 |
| 5112 | 41 | 2026-09-21 | delivered | 24.9 |
| 5113 | 46 | 2026-09-27 | delivered | 94.6 |
| 5114 | 66 | 2026-09-28 | delivered | 29.9 |
| 5115 | 67 | 2026-10-01 | delivered | 34.9 |
| 5116 | 51 | 2026-10-07 | delivered | 69.8 |
| 5117 | 53 | 2026-10-07 | cancelled | 34.9 |
| 5118 | 70 | 2026-10-09 | delivered | 211.9 |
| 5119 | 64 | 2026-10-16 | delivered | 698 |
| 5120 | 68 | 2026-10-21 | delivered | 183.9 |
| 5121 | 69 | 2026-10-27 | shipped | 159.4 |
| 5122 | 27 | 2026-10-30 | shipped | 118.9 |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
9. Customers with at least three orders
Task The sales table has one row per order line, not per order. Which customers have placed at least three orders that weren't cancelled? Show customer and orders (the number of distinct orders), most orders first, then by customer for ties.
sales 57 rows, 9 columns
| sale_id | order_id | order_date | customer | category | product | quantity | amount | status |
|---|---|---|---|---|---|---|---|---|
| 1 | 2001 | 2025-06-07 | Harbor Fremont Partners | Paper | Copy paper, 500 sheets | 32 | 153.28 | cancelled |
| 2 | 2001 | 2025-06-07 | Harbor Fremont Partners | Electronics | Cross-cut shredder | 1 | 129 | cancelled |
| 3 | 2001 | 2025-06-07 | Harbor Fremont Partners | Printer supplies | Black ink cartridge | 3 | 74.7 | cancelled |
| 4 | 2002 | 2025-06-12 | Northline Printing Co | Paper | Notebook A5, ruled | 17 | 93.33 | delivered |
| 5 | 2002 | 2025-06-12 | Northline Printing Co | Writing | Blue ballpoint pens, 10-pack | 14 | 48.86 | delivered |
| 6 | 2002 | 2025-06-12 | Northline Printing Co | Printer supplies | Black toner XL | 3 | 269.7 | delivered |
| 7 | 2003 | 2025-06-27 | Maple Grove High School | Writing | Blue ballpoint pens, 10-pack | 21 | 73.29 | delivered |
| 8 | 2003 | 2025-06-27 | Maple Grove High School | Electronics | 27-inch monitor | 3 | 837 | delivered |
| 9 | 2004 | 2025-07-08 | Westbrook Dental Clinic | Writing | Yellow sticky notes, 12 pads | 2 | 13.98 | delivered |
| 10 | 2004 | 2025-07-08 | Westbrook Dental Clinic | Paper | Notebook A5, ruled | 10 | 54.9 | delivered |
| 11 | 2005 | 2025-07-17 | Chloe Evans | Filing | Lever arch file, gray | 13 | 36.27 | delivered |
| 12 | 2005 | 2025-07-17 | Chloe Evans | Writing | Blue ballpoint pens, 10-pack | 5 | 17.45 | delivered |
| 13 | 2006 | 2025-07-26 | Westbrook Dental Clinic | Furniture | Comfort office chair | 2 | 358 | delivered |
| 14 | 2007 | 2025-08-04 | Riverside County Office | Printer supplies | Black ink cartridge | 4 | 99.6 | delivered |
| 15 | 2007 | 2025-08-04 | Riverside County Office | Electronics | Mono laser printer L30 | 1 | 219 | delivered |
| 16 | 2008 | 2025-08-06 | Raj Patel | Paper | Copy paper, 500 sheets | 12 | 57.48 | delivered |
| 17 | 2008 | 2025-08-06 | Raj Patel | Furniture | Comfort office chair | 2 | 358 | delivered |
| 18 | 2009 | 2025-08-26 | Chloe Evans | Electronics | 27-inch monitor | 1 | 279 | delivered |
| 19 | 2010 | 2025-09-05 | Westbrook Dental Clinic | Furniture | Comfort office chair | 1 | 179 | delivered |
| 20 | 2010 | 2025-09-05 | Westbrook Dental Clinic | Printer supplies | Black ink cartridge | 2 | 49.8 | delivered |
| 21 | 2011 | 2025-09-10 | Olivia Brooks | Electronics | 27-inch monitor | 1 | 279 | delivered |
| 22 | 2012 | 2025-09-13 | Northline Printing Co | Writing | Blue ballpoint pens, 10-pack | 21 | 73.29 | delivered |
| 23 | 2013 | 2025-10-09 | Maple Grove High School | Electronics | 27-inch monitor | 3 | 837 | cancelled |
| 24 | 2013 | 2025-10-09 | Maple Grove High School | Filing | Lever arch file, gray | 10 | 27.9 | cancelled |
| 25 | 2014 | 2025-10-24 | Raj Patel | Writing | Yellow sticky notes, 12 pads | 3 | 20.97 | delivered |
| 26 | 2015 | 2025-10-25 | Greene & Shaw LLP | Writing | Yellow sticky notes, 12 pads | 8 | 55.92 | cancelled |
| 27 | 2015 | 2025-10-25 | Greene & Shaw LLP | Electronics | 27-inch monitor | 2 | 558 | cancelled |
| 28 | 2015 | 2025-10-25 | Greene & Shaw LLP | Paper | Notebook A5, ruled | 20 | 109.8 | cancelled |
| 29 | 2016 | 2025-11-19 | Northline Printing Co | Writing | Blue ballpoint pens, 10-pack | 16 | 55.84 | cancelled |
| 30 | 2017 | 2025-11-22 | Emily Carter | Filing | Lever arch file, gray | 14 | 39.06 | delivered |
| 31 | 2018 | 2025-11-24 | Chloe Evans | Furniture | Comfort office chair | 2 | 358 | delivered |
| 32 | 2018 | 2025-11-24 | Chloe Evans | Writing | Yellow sticky notes, 12 pads | 2 | 13.98 | delivered |
| 33 | 2019 | 2025-12-09 | Northline Printing Co | Furniture | Standing desk | 2 | 898 | delivered |
| 34 | 2019 | 2025-12-09 | Northline Printing Co | Paper | Notebook A5, ruled | 34 | 186.66 | delivered |
| 35 | 2020 | 2025-12-26 | Lakeview Hotel Ltd | Writing | Blue ballpoint pens, 10-pack | 40 | 139.6 | delivered |
| 36 | 2020 | 2025-12-26 | Lakeview Hotel Ltd | Furniture | Comfort office chair | 3 | 537 | delivered |
| 37 | 2021 | 2026-01-03 | Westbrook Dental Clinic | Paper | Copy paper, 500 sheets | 24 | 114.96 | delivered |
| 38 | 2021 | 2026-01-03 | Westbrook Dental Clinic | Electronics | 27-inch monitor | 1 | 279 | delivered |
| 39 | 2022 | 2026-01-06 | Northline Printing Co | Printer supplies | Black ink cartridge | 3 | 74.7 | delivered |
| 40 | 2023 | 2026-02-03 | Lakeview Hotel Ltd | Writing | Yellow sticky notes, 12 pads | 2 | 13.98 | delivered |
| 41 | 2024 | 2026-02-23 | Chloe Evans | Writing | Blue ballpoint pens, 10-pack | 5 | 17.45 | delivered |
| 42 | 2025 | 2026-03-09 | Raj Patel | Furniture | Comfort office chair | 2 | 358 | delivered |
| 43 | 2026 | 2026-03-20 | Harbor Fremont Partners | Writing | Blue ballpoint pens, 10-pack | 27 | 94.23 | delivered |
| 44 | 2026 | 2026-03-20 | Harbor Fremont Partners | Furniture | Standing desk | 2 | 898 | delivered |
| 45 | 2026 | 2026-03-20 | Harbor Fremont Partners | Printer supplies | Black ink cartridge | 10 | 249 | delivered |
| 46 | 2027 | 2026-04-07 | Northline Printing Co | Electronics | Cross-cut shredder | 1 | 129 | delivered |
| 47 | 2027 | 2026-04-07 | Northline Printing Co | Furniture | Comfort office chair | 2 | 358 | delivered |
| 48 | 2028 | 2026-04-08 | Greene & Shaw LLP | Paper | Notebook A5, ruled | 50 | 274.5 | cancelled |
| 49 | 2028 | 2026-04-08 | Greene & Shaw LLP | Filing | Lever arch file, gray | 12 | 33.48 | cancelled |
| 50 | 2029 | 2026-05-09 | Greene & Shaw LLP | Filing | Lever arch file, gray | 41 | 114.39 | delivered |
| 51 | 2029 | 2026-05-09 | Greene & Shaw LLP | Paper | Notebook A5, ruled | 57 | 312.93 | delivered |
| 52 | 2030 | 2026-05-13 | Maple Grove High School | Paper | Notebook A5, ruled | 21 | 115.29 | delivered |
| 53 | 2031 | 2026-06-14 | Olivia Brooks | Paper | Notebook A5, ruled | 18 | 98.82 | shipped |
| 54 | 2031 | 2026-06-14 | Olivia Brooks | Electronics | 27-inch monitor | 1 | 279 | shipped |
| 55 | 2032 | 2026-06-19 | Northline Printing Co | Filing | Lever arch file, gray | 14 | 39.06 | open |
| 56 | 2032 | 2026-06-19 | Northline Printing Co | Paper | Notebook A5, ruled | 46 | 252.54 | open |
| 57 | 2032 | 2026-06-19 | Northline Printing Co | Writing | Blue ballpoint pens, 10-pack | 21 | 73.29 | open |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
10. Average lines per order
Task How many lines does an order have on average? Show a single number, lines_per_order, across all orders, rounded to 2 decimal places.
order_items 38 rows, 4 columns
| order_id | product_id | quantity | unit_price |
|---|---|---|---|
| 1001 | 1 | 40 | 4.79 |
| 1001 | 3 | 25 | 2.79 |
| 1001 | 6 | 4 | 24.9 |
| 1002 | 2 | 2 | 3.49 |
| 1002 | 10 | 3 | 5.49 |
| 1003 | 1 | 60 | 4.69 |
| 1003 | 11 | 6 | 84.9 |
| 1003 | 3 | 50 | 2.59 |
| 1004 | 4 | 3 | 179 |
| 1004 | 9 | 3 | 269 |
| 1005 | 5 | 1 | 449 |
| 1006 | 1 | 30 | 4.79 |
| 1006 | 7 | 10 | 6.99 |
| 1007 | 8 | 2 | 219 |
| 1007 | 11 | 4 | 89.9 |
| 1007 | 1 | 20 | 4.99 |
| 1008 | 4 | 6 | 175 |
| 1008 | 2 | 5 | 3.49 |
| 1009 | 10 | 120 | 4.99 |
| 1009 | 2 | 40 | 3.19 |
| 1009 | 9 | 2 | 279 |
| 1010 | 7 | 2 | 6.99 |
| 1010 | 2 | 1 | 3.49 |
| 1011 | 12 | 1 | 129 |
| 1011 | 1 | 10 | 4.99 |
| 1011 | 3 | 12 | 2.79 |
| 1012 | 6 | 8 | 23.9 |
| 1012 | 1 | 40 | 4.69 |
| 1013 | 9 | 1 | 279 |
| 1014 | 5 | 2 | 439 |
| 1014 | 4 | 2 | 179 |
| 1015 | 1 | 50 | 4.79 |
| 1015 | 11 | 2 | 89.9 |
| 1016 | 10 | 4 | 5.49 |
| 1017 | 2 | 3 | 3.49 |
| 1017 | 7 | 2 | 6.99 |
| 1018 | 1 | 80 | 4.79 |
| 1018 | 6 | 10 | 24.9 |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
11. Text after the comma
Task Many product names have the pack size or version after a comma, such as "500 sheets". For a new filter in the shop, that part should go into its own column. For every product whose name contains a comma, show name and suffix: the text after the comma without the space in front of it.
products 12 rows, 5 columns
| product_id | name | category | price | stock |
|---|---|---|---|---|
| 1 | Copy paper, 500 sheets | Paper | 4.99 | 420 |
| 2 | Blue ballpoint pens, 10-pack | Writing | 3.49 | 310 |
| 3 | Lever arch file, gray | Filing | 2.79 | 185 |
| 4 | Comfort office chair | Furniture | 189 | 12 |
| 5 | Standing desk | Furniture | 449 | 5 |
| 6 | Black ink cartridge | Printer supplies | 24.9 | 64 |
| 7 | Yellow sticky notes, 12 pads | Writing | 6.99 | 0 |
| 8 | Mono laser printer L30 | Electronics | 219 | 8 |
| 9 | 27-inch monitor | Electronics | 279 | 15 |
| 10 | Notebook A5, ruled | Paper | 5.49 | 140 |
| 11 | Black toner XL | Printer supplies | 89.9 | 22 |
| 12 | Cross-cut shredder | Electronics | 129 | 0 |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
12. Big baskets
Task The shop team wants to know how often customers buy several items at once. Show every completed order with at least three different products: order_id, order_date, products (the number of different products) and amount, sorted by order_id.
orders 239 rows, 6 columns
| order_id | customer_id | order_date | campaign_id | status | amount |
|---|---|---|---|---|---|
| 5001 | 1 | 2025-01-16 | 1 | completed | 29.8 |
| 5002 | 2 | 2025-01-24 | NULL | completed | 139.7 |
| 5003 | 3 | 2025-01-28 | NULL | completed | 49.9 |
| 5004 | 4 | 2025-02-01 | 4 | completed | 69.8 |
| 5005 | 5 | 2025-02-07 | 3 | completed | 89.9 |
| 5006 | 6 | 2025-02-14 | NULL | completed | 24.9 |
| 5007 | 7 | 2025-02-25 | NULL | cancelled | 24.9 |
| 5008 | 8 | 2025-03-03 | 2 | completed | 139.7 |
| 5009 | 9 | 2025-03-06 | 2 | completed | 34.9 |
| 5010 | 6 | 2025-03-13 | NULL | completed | 24.9 |
| 5011 | 10 | 2025-03-15 | 2 | completed | 19.9 |
| 5012 | 11 | 2025-03-17 | NULL | completed | 49.9 |
| 5013 | 12 | 2025-03-29 | 3 | cancelled | 89.9 |
| 5014 | 13 | 2025-03-30 | 4 | completed | 24.9 |
| 5015 | 2 | 2025-04-03 | 3 | completed | 24.9 |
| 5016 | 14 | 2025-04-05 | 4 | completed | 79.9 |
| 5017 | 5 | 2025-04-06 | 3 | completed | 34.9 |
| 5018 | 10 | 2025-04-10 | NULL | completed | 89.9 |
| 5019 | 15 | 2025-04-12 | 3 | completed | 114.8 |
| 5020 | 16 | 2025-04-19 | 3 | completed | 99.9 |
| 5021 | 17 | 2025-04-26 | NULL | cancelled | 79.9 |
| 5022 | 7 | 2025-04-30 | NULL | completed | 29.9 |
| 5023 | 18 | 2025-05-03 | NULL | completed | 34.9 |
| 5024 | 19 | 2025-05-08 | NULL | completed | 89.9 |
| 5025 | 20 | 2025-05-12 | 3 | completed | 19.9 |
| 5026 | 21 | 2025-05-17 | 2 | cancelled | 39.9 |
| 5027 | 22 | 2025-05-18 | NULL | completed | 79.9 |
| 5028 | 14 | 2025-05-24 | 1 | completed | 89.9 |
| 5029 | 23 | 2025-05-25 | 1 | completed | 29.8 |
| 5030 | 16 | 2025-06-01 | 3 | cancelled | 27.9 |
| 5031 | 24 | 2025-06-01 | NULL | completed | 19.9 |
| 5032 | 25 | 2025-06-09 | 3 | completed | 79.9 |
| 5033 | 26 | 2025-06-15 | 6 | cancelled | 34.9 |
| 5034 | 27 | 2025-06-16 | 3 | completed | 24.9 |
| 5035 | 28 | 2025-06-18 | 6 | completed | 29.8 |
| 5036 | 29 | 2025-06-25 | 6 | completed | 19.9 |
| 5037 | 30 | 2025-07-06 | NULL | completed | 19.8 |
| 5038 | 31 | 2025-07-08 | 5 | completed | 24.9 |
| 5039 | 32 | 2025-07-10 | 5 | completed | 119.7 |
| 5040 | 33 | 2025-07-14 | 6 | completed | 49.9 |
| 5041 | 34 | 2025-07-24 | 6 | completed | 34.9 |
| 5042 | 35 | 2025-07-28 | 6 | cancelled | 89.9 |
| 5043 | 24 | 2025-07-29 | 3 | completed | 34.9 |
| 5044 | 36 | 2025-08-01 | 6 | completed | 104.8 |
| 5045 | 5 | 2025-08-05 | 3 | completed | 29.9 |
| 5046 | 37 | 2025-08-06 | NULL | cancelled | 119 |
| 5047 | 2 | 2025-08-07 | 3 | completed | 89.9 |
| 5048 | 38 | 2025-08-09 | NULL | completed | 9.9 |
| 5049 | 39 | 2025-08-14 | 6 | completed | 19.9 |
| 5050 | 40 | 2025-08-19 | 4 | completed | 89.9 |
| 5051 | 41 | 2025-08-29 | NULL | completed | 89.9 |
| 5052 | 42 | 2025-08-29 | 3 | completed | 12.9 |
| 5053 | 43 | 2025-09-03 | NULL | completed | 24.9 |
| 5054 | 44 | 2025-09-06 | 5 | completed | 34.9 |
| 5055 | 23 | 2025-09-07 | 5 | completed | 99.9 |
| 5056 | 38 | 2025-09-12 | 3 | completed | 25.8 |
| 5057 | 45 | 2025-09-15 | NULL | completed | 19.9 |
| 5058 | 46 | 2025-09-18 | 5 | completed | 99.9 |
| 5059 | 41 | 2025-09-19 | NULL | completed | 34.9 |
| 5060 | 47 | 2025-09-19 | NULL | completed | 9.9 |
| 5061 | 5 | 2025-09-24 | NULL | completed | 24.9 |
| 5062 | 48 | 2025-09-29 | NULL | completed | 79.9 |
| 5063 | 49 | 2025-09-29 | 5 | completed | 29.9 |
| 5064 | 50 | 2025-10-08 | NULL | completed | 129 |
| 5065 | 14 | 2025-10-10 | NULL | completed | 86.7 |
| 5066 | 51 | 2025-10-11 | 5 | completed | 119.7 |
| 5067 | 16 | 2025-10-12 | 5 | completed | 99.9 |
| 5068 | 52 | 2025-10-14 | 5 | completed | 119.7 |
| 5069 | 34 | 2025-10-19 | NULL | completed | 54.8 |
| 5070 | 21 | 2025-10-20 | NULL | completed | 49.9 |
| 5071 | 42 | 2025-10-20 | 5 | completed | 16.9 |
| 5072 | 53 | 2025-10-21 | 3 | completed | 89.9 |
| 5073 | 54 | 2025-10-24 | NULL | completed | 54.8 |
| 5074 | 55 | 2025-10-29 | 5 | completed | 99.9 |
| 5075 | 56 | 2025-11-04 | NULL | completed | 34.9 |
| 5076 | 57 | 2025-11-05 | 5 | completed | 114.8 |
| 5077 | 27 | 2025-11-07 | 3 | completed | 12.9 |
| 5078 | 31 | 2025-11-07 | NULL | completed | 59.9 |
| 5079 | 32 | 2025-11-07 | NULL | completed | 27.9 |
| 5080 | 58 | 2025-11-18 | NULL | completed | 19.9 |
| 5081 | 59 | 2025-11-23 | 5 | completed | 89.9 |
| 5082 | 60 | 2025-11-23 | 8 | completed | 25.8 |
| 5083 | 12 | 2025-11-24 | 7 | completed | 47.92 |
| 5084 | 15 | 2025-11-24 | 8 | completed | 91.84 |
| 5085 | 48 | 2025-11-24 | 7 | completed | 55.76 |
| 5086 | 51 | 2025-11-24 | 7 | completed | 23.92 |
| 5087 | 1 | 2025-11-25 | 7 | completed | 31.92 |
| 5088 | 7 | 2025-11-25 | NULL | completed | 47.92 |
| 5089 | 61 | 2025-11-25 | 3 | completed | 23.92 |
| 5090 | 6 | 2025-11-26 | 7 | completed | 39.92 |
| 5091 | 31 | 2025-11-26 | 8 | completed | 23.92 |
| 5092 | 56 | 2025-11-26 | 8 | completed | 10.32 |
| 5093 | 13 | 2025-11-27 | 7 | cancelled | 91.84 |
| 5094 | 30 | 2025-11-27 | 7 | completed | 31.92 |
| 5095 | 38 | 2025-11-28 | 7 | completed | 103.2 |
| 5096 | 55 | 2025-11-28 | 8 | completed | 63.92 |
| 5097 | 9 | 2025-11-29 | 8 | completed | 27.92 |
| 5098 | 5 | 2025-11-30 | 8 | completed | 15.84 |
| 5099 | 42 | 2025-11-30 | 3 | completed | 7.92 |
| 5100 | 44 | 2025-11-30 | 7 | completed | 48.56 |
| 5101 | 46 | 2025-11-30 | 7 | completed | 38.24 |
| 5102 | 47 | 2025-11-30 | 7 | completed | 31.92 |
| 5103 | 24 | 2025-12-01 | 7 | completed | 90.24 |
| 5104 | 62 | 2025-12-01 | 8 | completed | 15.92 |
| 5105 | 63 | 2025-12-08 | NULL | completed | 19.8 |
| 5106 | 64 | 2025-12-11 | NULL | completed | 114.8 |
| 5107 | 14 | 2025-12-12 | NULL | completed | 29.9 |
| 5108 | 65 | 2025-12-15 | 5 | completed | 89.7 |
| 5109 | 66 | 2025-12-19 | 5 | completed | 104.8 |
| 5110 | 67 | 2025-12-25 | NULL | completed | 34.9 |
| 5111 | 68 | 2025-12-26 | NULL | completed | 59.9 |
| 5112 | 42 | 2026-01-04 | NULL | completed | 79.9 |
| 5113 | 69 | 2026-01-06 | 10 | completed | 16.9 |
| 5114 | 70 | 2026-01-06 | 3 | completed | 19.9 |
| 5115 | 2 | 2026-01-09 | 9 | completed | 89.9 |
| 5116 | 71 | 2026-01-16 | 9 | completed | 25.8 |
| 5117 | 72 | 2026-01-17 | 9 | completed | 89.9 |
| 5118 | 50 | 2026-01-18 | NULL | completed | 19.9 |
| 5119 | 73 | 2026-01-23 | 10 | completed | 59.9 |
| 5120 | 74 | 2026-01-26 | NULL | completed | 19.8 |
| 5121 | 75 | 2026-02-02 | 9 | completed | 119 |
| 5122 | 76 | 2026-02-06 | 4 | completed | 24.9 |
| 5123 | 77 | 2026-02-07 | NULL | completed | 79.9 |
| 5124 | 78 | 2026-02-13 | NULL | completed | 9.9 |
| 5125 | 79 | 2026-02-15 | NULL | completed | 104.8 |
| 5126 | 74 | 2026-02-18 | NULL | completed | 49.9 |
| 5127 | 80 | 2026-02-20 | 4 | completed | 19.9 |
| 5128 | 68 | 2026-02-24 | NULL | completed | 12.9 |
| 5129 | 81 | 2026-02-25 | 9 | completed | 29.9 |
| 5130 | 52 | 2026-02-28 | NULL | completed | 59.9 |
| 5131 | 38 | 2026-03-01 | 3 | completed | 89.9 |
| 5132 | 82 | 2026-03-01 | NULL | completed | 19.9 |
| 5133 | 4 | 2026-03-02 | NULL | completed | 29.8 |
| 5134 | 67 | 2026-03-03 | 11 | completed | 39.9 |
| 5135 | 2 | 2026-03-05 | 9 | completed | 44.9 |
| 5136 | 17 | 2026-03-05 | NULL | completed | 79.9 |
| 5137 | 31 | 2026-03-06 | NULL | completed | 136.7 |
| 5138 | 83 | 2026-03-07 | NULL | completed | 49.9 |
| 5139 | 70 | 2026-03-08 | 11 | completed | 47.8 |
| 5140 | 84 | 2026-03-11 | 3 | completed | 49.8 |
| 5141 | 7 | 2026-03-12 | NULL | completed | 19.9 |
| 5142 | 53 | 2026-03-12 | 11 | completed | 19.9 |
| 5143 | 85 | 2026-03-12 | 4 | completed | 22.8 |
| 5144 | 5 | 2026-03-13 | NULL | cancelled | 104.8 |
| 5145 | 16 | 2026-03-14 | 9 | completed | 34.9 |
| 5146 | 57 | 2026-03-15 | NULL | completed | 107.8 |
| 5147 | 14 | 2026-03-16 | 11 | completed | 24.9 |
| 5148 | 32 | 2026-03-16 | 11 | completed | 34.9 |
| 5149 | 54 | 2026-03-17 | NULL | completed | 34.9 |
| 5150 | 86 | 2026-03-17 | NULL | completed | 25.8 |
| 5151 | 27 | 2026-03-18 | NULL | completed | 9.9 |
| 5152 | 87 | 2026-03-19 | 9 | completed | 119 |
| 5153 | 72 | 2026-03-22 | 11 | completed | 24.9 |
| 5154 | 88 | 2026-04-01 | 4 | completed | 29.9 |
| 5155 | 89 | 2026-04-05 | 9 | completed | 49.9 |
| 5156 | 90 | 2026-04-05 | 9 | completed | 102.8 |
| 5157 | 74 | 2026-04-06 | 3 | completed | 24.9 |
| 5158 | 91 | 2026-04-11 | 9 | completed | 29.9 |
| 5159 | 61 | 2026-04-12 | NULL | completed | 79.9 |
| 5160 | 92 | 2026-04-14 | NULL | completed | 29.9 |
| 5161 | 93 | 2026-04-19 | NULL | completed | 29.9 |
| 5162 | 94 | 2026-04-24 | 9 | completed | 29.9 |
| 5163 | 95 | 2026-04-28 | 4 | completed | 44.9 |
| 5164 | 96 | 2026-04-30 | 9 | completed | 129 |
| 5165 | 92 | 2026-05-07 | NULL | completed | 55.7 |
| 5166 | 97 | 2026-05-10 | 4 | completed | 54.8 |
| 5167 | 98 | 2026-05-11 | 9 | completed | 14.9 |
| 5168 | 99 | 2026-05-13 | 4 | completed | 34.9 |
| 5169 | 100 | 2026-05-18 | 9 | completed | 129 |
| 5170 | 101 | 2026-05-19 | 4 | completed | 148.7 |
| 5171 | 63 | 2026-05-23 | 3 | cancelled | 24.9 |
| 5172 | 102 | 2026-05-25 | NULL | completed | 44.9 |
| 5173 | 78 | 2026-06-01 | NULL | cancelled | 153.9 |
| 5174 | 103 | 2026-06-01 | NULL | completed | 99.9 |
| 5175 | 42 | 2026-06-02 | 9 | completed | 129 |
| 5176 | 104 | 2026-06-04 | NULL | completed | 49.9 |
| 5177 | 105 | 2026-06-08 | NULL | completed | 19.9 |
| 5178 | 50 | 2026-06-09 | NULL | completed | 102.8 |
| 5179 | 106 | 2026-06-09 | NULL | completed | 119.7 |
| 5180 | 107 | 2026-06-16 | 4 | cancelled | 29.7 |
| 5181 | 108 | 2026-06-22 | 9 | completed | 12.9 |
| 5182 | 79 | 2026-06-23 | 3 | completed | 99.9 |
| 5183 | 109 | 2026-06-26 | 4 | completed | 129 |
| 5184 | 110 | 2026-06-26 | NULL | cancelled | 24.9 |
| 5185 | 81 | 2026-06-28 | NULL | completed | 99.9 |
| 5186 | 111 | 2026-07-02 | NULL | completed | 158.9 |
| 5187 | 77 | 2026-07-04 | NULL | completed | 114.7 |
| 5188 | 112 | 2026-07-04 | NULL | completed | 39.9 |
| 5189 | 113 | 2026-07-09 | 4 | cancelled | 19.9 |
| 5190 | 114 | 2026-07-14 | NULL | completed | 49.9 |
| 5191 | 83 | 2026-07-15 | NULL | completed | 148.7 |
| 5192 | 76 | 2026-07-17 | NULL | completed | 34.9 |
| 5193 | 84 | 2026-07-17 | NULL | completed | 34.9 |
| 5194 | 115 | 2026-07-19 | NULL | completed | 79.9 |
| 5195 | 74 | 2026-07-23 | 3 | completed | 33.8 |
| 5196 | 92 | 2026-07-27 | 12 | completed | 19.9 |
| 5197 | 116 | 2026-07-27 | 12 | completed | 27.9 |
| 5198 | 117 | 2026-07-28 | NULL | completed | 99.9 |
| 5199 | 67 | 2026-07-30 | 3 | completed | 29.9 |
| 5200 | 118 | 2026-08-03 | NULL | completed | 119 |
| 5201 | 119 | 2026-08-07 | 3 | completed | 102.8 |
| 5202 | 120 | 2026-08-09 | NULL | completed | 89.9 |
| 5203 | 93 | 2026-08-15 | 3 | completed | 47.8 |
| 5204 | 121 | 2026-08-15 | NULL | completed | 27.9 |
| 5205 | 122 | 2026-08-18 | NULL | completed | 44.9 |
| 5206 | 102 | 2026-08-24 | 3 | completed | 89.8 |
| 5207 | 123 | 2026-08-25 | 12 | completed | 142.7 |
| 5208 | 124 | 2026-08-27 | 12 | completed | 113.7 |
| 5209 | 95 | 2026-08-28 | 12 | completed | 99.9 |
| 5210 | 92 | 2026-08-31 | 3 | completed | 29.8 |
| 5211 | 125 | 2026-08-31 | 3 | completed | 19.9 |
| 5212 | 110 | 2026-09-01 | NULL | completed | 42.7 |
| 5213 | 126 | 2026-09-03 | 3 | completed | 29.9 |
| 5214 | 127 | 2026-09-07 | NULL | completed | 29.8 |
| 5215 | 128 | 2026-09-13 | NULL | completed | 24.9 |
| 5216 | 129 | 2026-09-19 | 13 | completed | 89.9 |
| 5217 | 130 | 2026-09-20 | NULL | completed | 19.9 |
| 5218 | 117 | 2026-09-21 | 3 | completed | 96.8 |
| 5219 | 131 | 2026-09-22 | 3 | completed | 89.9 |
| 5220 | 50 | 2026-09-23 | NULL | completed | 44.9 |
| 5221 | 91 | 2026-09-23 | NULL | completed | 89.9 |
| 5222 | 92 | 2026-09-23 | 3 | completed | 89.9 |
| 5223 | 132 | 2026-09-26 | 12 | completed | 89.9 |
| 5224 | 115 | 2026-10-03 | NULL | completed | 25.8 |
| 5225 | 133 | 2026-10-04 | 13 | cancelled | 49.9 |
| 5226 | 63 | 2026-10-05 | NULL | completed | 24.9 |
| 5227 | 134 | 2026-10-05 | 13 | completed | 27.9 |
| 5228 | 106 | 2026-10-08 | NULL | completed | 29.9 |
| 5229 | 119 | 2026-10-08 | NULL | completed | 24.9 |
| 5230 | 135 | 2026-10-10 | 12 | completed | 24.9 |
| 5231 | 95 | 2026-10-13 | NULL | completed | 24.9 |
| 5232 | 102 | 2026-10-13 | NULL | completed | 49.9 |
| 5233 | 98 | 2026-10-14 | NULL | completed | 14.9 |
| 5234 | 136 | 2026-10-16 | 4 | completed | 24.9 |
| 5235 | 137 | 2026-10-20 | 3 | completed | 34.9 |
| 5236 | 138 | 2026-10-22 | 13 | completed | 34.9 |
| 5237 | 139 | 2026-10-27 | NULL | completed | 89.8 |
| 5238 | 140 | 2026-10-29 | 3 | completed | 19.9 |
| 5239 | 112 | 2026-10-31 | NULL | completed | 104.8 |
order_items 297 rows, 4 columns
| order_id | product_id | quantity | unit_price |
|---|---|---|---|
| 5001 | 21 | 1 | 19.9 |
| 5001 | 22 | 1 | 9.9 |
| 5002 | 1 | 1 | 89.9 |
| 5002 | 3 | 1 | 24.9 |
| 5002 | 9 | 1 | 24.9 |
| 5003 | 7 | 1 | 49.9 |
| 5004 | 7 | 1 | 49.9 |
| 5004 | 8 | 1 | 19.9 |
| 5005 | 1 | 1 | 89.9 |
| 5006 | 3 | 1 | 24.9 |
| 5007 | 9 | 1 | 24.9 |
| 5008 | 1 | 1 | 89.9 |
| 5008 | 2 | 1 | 14.9 |
| 5008 | 5 | 1 | 34.9 |
| 5009 | 5 | 1 | 34.9 |
| 5010 | 3 | 1 | 24.9 |
| 5011 | 21 | 1 | 19.9 |
| 5012 | 7 | 1 | 49.9 |
| 5013 | 1 | 1 | 89.9 |
| 5014 | 9 | 1 | 24.9 |
| 5015 | 9 | 1 | 24.9 |
| 5016 | 13 | 1 | 79.9 |
| 5017 | 5 | 1 | 34.9 |
| 5018 | 1 | 1 | 89.9 |
| 5019 | 1 | 1 | 89.9 |
| 5019 | 3 | 1 | 24.9 |
| 5020 | 16 | 1 | 99.9 |
| 5021 | 13 | 1 | 79.9 |
| 5022 | 19 | 1 | 29.9 |
| 5023 | 5 | 1 | 34.9 |
| 5024 | 1 | 1 | 89.9 |
| 5025 | 8 | 1 | 19.9 |
| 5026 | 23 | 1 | 39.9 |
| 5027 | 13 | 1 | 79.9 |
| 5028 | 1 | 1 | 89.9 |
| 5029 | 21 | 1 | 19.9 |
| 5029 | 22 | 1 | 9.9 |
| 5030 | 15 | 1 | 27.9 |
| 5031 | 8 | 1 | 19.9 |
| 5032 | 13 | 1 | 79.9 |
| 5033 | 5 | 1 | 34.9 |
| 5034 | 9 | 1 | 24.9 |
| 5035 | 2 | 2 | 14.9 |
| 5036 | 21 | 1 | 19.9 |
| 5037 | 18 | 2 | 9.9 |
| 5038 | 3 | 1 | 24.9 |
| 5039 | 1 | 1 | 89.9 |
| 5039 | 2 | 2 | 14.9 |
| 5040 | 7 | 1 | 49.9 |
| 5041 | 5 | 1 | 34.9 |
| 5042 | 1 | 1 | 89.9 |
| 5043 | 5 | 1 | 34.9 |
| 5044 | 1 | 1 | 89.9 |
| 5044 | 2 | 1 | 14.9 |
| 5045 | 11 | 1 | 29.9 |
| 5046 | 17 | 1 | 119 |
| 5047 | 1 | 1 | 89.9 |
| 5048 | 18 | 1 | 9.9 |
| 5049 | 21 | 1 | 19.9 |
| 5050 | 1 | 1 | 89.9 |
| 5051 | 1 | 1 | 89.9 |
| 5052 | 4 | 1 | 12.9 |
| 5053 | 9 | 1 | 24.9 |
| 5054 | 5 | 1 | 34.9 |
| 5055 | 16 | 1 | 99.9 |
| 5056 | 4 | 2 | 12.9 |
| 5057 | 8 | 1 | 19.9 |
| 5058 | 16 | 1 | 99.9 |
| 5059 | 5 | 1 | 34.9 |
| 5060 | 22 | 1 | 9.9 |
| 5061 | 3 | 1 | 24.9 |
| 5062 | 13 | 1 | 79.9 |
| 5063 | 11 | 1 | 29.9 |
| 5064 | 24 | 1 | 129 |
| 5065 | 7 | 1 | 49.9 |
| 5065 | 8 | 1 | 19.9 |
| 5065 | 14 | 1 | 16.9 |
| 5066 | 1 | 1 | 89.9 |
| 5066 | 2 | 2 | 14.9 |
| 5067 | 16 | 1 | 99.9 |
| 5068 | 1 | 1 | 89.9 |
| 5068 | 2 | 2 | 14.9 |
| 5069 | 5 | 1 | 34.9 |
| 5069 | 8 | 1 | 19.9 |
| 5070 | 7 | 1 | 49.9 |
| 5071 | 14 | 1 | 16.9 |
| 5072 | 1 | 1 | 89.9 |
| 5073 | 5 | 1 | 34.9 |
| 5073 | 8 | 1 | 19.9 |
| 5074 | 16 | 1 | 99.9 |
| 5075 | 5 | 1 | 34.9 |
| 5076 | 1 | 1 | 89.9 |
| 5076 | 3 | 1 | 24.9 |
| 5077 | 4 | 1 | 12.9 |
| 5078 | 10 | 1 | 59.9 |
| 5079 | 15 | 1 | 27.9 |
| 5080 | 21 | 1 | 19.9 |
| 5081 | 1 | 1 | 89.9 |
| 5082 | 4 | 2 | 12.9 |
| 5083 | 10 | 1 | 47.92 |
| 5084 | 1 | 1 | 71.92 |
| 5084 | 3 | 1 | 19.92 |
| 5085 | 11 | 1 | 23.92 |
| 5085 | 19 | 1 | 23.92 |
| 5085 | 20 | 1 | 7.92 |
| 5086 | 11 | 1 | 23.92 |
| 5087 | 23 | 1 | 31.92 |
| 5088 | 10 | 1 | 47.92 |
| 5089 | 11 | 1 | 23.92 |
| 5090 | 7 | 1 | 39.92 |
| 5091 | 11 | 1 | 23.92 |
| 5092 | 6 | 1 | 10.32 |
| 5093 | 1 | 1 | 71.92 |
| 5093 | 3 | 1 | 19.92 |
| 5094 | 23 | 1 | 31.92 |
| 5095 | 24 | 1 | 103.2 |
| 5096 | 13 | 1 | 63.92 |
| 5097 | 5 | 1 | 27.92 |
| 5098 | 22 | 2 | 7.92 |
| 5099 | 22 | 1 | 7.92 |
| 5100 | 5 | 1 | 27.92 |
| 5100 | 6 | 2 | 10.32 |
| 5101 | 5 | 1 | 27.92 |
| 5101 | 6 | 1 | 10.32 |
| 5102 | 23 | 1 | 31.92 |
| 5103 | 6 | 1 | 10.32 |
| 5103 | 16 | 1 | 79.92 |
| 5104 | 21 | 1 | 15.92 |
| 5105 | 22 | 2 | 9.9 |
| 5106 | 1 | 1 | 89.9 |
| 5106 | 9 | 1 | 24.9 |
| 5107 | 11 | 1 | 29.9 |
| 5108 | 7 | 1 | 49.9 |
| 5108 | 19 | 1 | 29.9 |
| 5108 | 20 | 1 | 9.9 |
| 5109 | 1 | 1 | 89.9 |
| 5109 | 2 | 1 | 14.9 |
| 5110 | 5 | 1 | 34.9 |
| 5111 | 10 | 1 | 59.9 |
| 5112 | 13 | 1 | 79.9 |
| 5113 | 14 | 1 | 16.9 |
| 5114 | 21 | 1 | 19.9 |
| 5115 | 1 | 1 | 89.9 |
| 5116 | 6 | 2 | 12.9 |
| 5117 | 1 | 1 | 89.9 |
| 5118 | 21 | 1 | 19.9 |
| 5119 | 10 | 1 | 59.9 |
| 5120 | 18 | 2 | 9.9 |
| 5121 | 17 | 1 | 119 |
| 5122 | 9 | 1 | 24.9 |
| 5123 | 13 | 1 | 79.9 |
| 5124 | 20 | 1 | 9.9 |
| 5125 | 1 | 1 | 89.9 |
| 5125 | 2 | 1 | 14.9 |
| 5126 | 7 | 1 | 49.9 |
| 5127 | 21 | 1 | 19.9 |
| 5128 | 4 | 1 | 12.9 |
| 5129 | 11 | 1 | 29.9 |
| 5130 | 10 | 1 | 59.9 |
| 5131 | 1 | 1 | 89.9 |
| 5132 | 8 | 1 | 19.9 |
| 5133 | 21 | 1 | 19.9 |
| 5133 | 22 | 1 | 9.9 |
| 5134 | 23 | 1 | 39.9 |
| 5135 | 12 | 1 | 44.9 |
| 5136 | 13 | 1 | 79.9 |
| 5137 | 13 | 1 | 79.9 |
| 5137 | 14 | 1 | 16.9 |
| 5137 | 23 | 1 | 39.9 |
| 5138 | 7 | 1 | 49.9 |
| 5139 | 5 | 1 | 34.9 |
| 5139 | 6 | 1 | 12.9 |
| 5140 | 19 | 1 | 29.9 |
| 5140 | 21 | 1 | 19.9 |
| 5141 | 8 | 1 | 19.9 |
| 5142 | 8 | 1 | 19.9 |
| 5143 | 4 | 1 | 12.9 |
| 5143 | 22 | 1 | 9.9 |
| 5144 | 1 | 1 | 89.9 |
| 5144 | 2 | 1 | 14.9 |
| 5145 | 5 | 1 | 34.9 |
| 5146 | 13 | 1 | 79.9 |
| 5146 | 15 | 1 | 27.9 |
| 5147 | 9 | 1 | 24.9 |
| 5148 | 5 | 1 | 34.9 |
| 5149 | 5 | 1 | 34.9 |
| 5150 | 4 | 2 | 12.9 |
| 5151 | 22 | 1 | 9.9 |
| 5152 | 17 | 1 | 119 |
| 5153 | 3 | 1 | 24.9 |
| 5154 | 19 | 1 | 29.9 |
| 5155 | 7 | 1 | 49.9 |
| 5156 | 1 | 1 | 89.9 |
| 5156 | 4 | 1 | 12.9 |
| 5157 | 3 | 1 | 24.9 |
| 5158 | 11 | 1 | 29.9 |
| 5159 | 13 | 1 | 79.9 |
| 5160 | 11 | 1 | 29.9 |
| 5161 | 11 | 1 | 29.9 |
| 5162 | 19 | 1 | 29.9 |
| 5163 | 12 | 1 | 44.9 |
| 5164 | 24 | 1 | 129 |
| 5165 | 4 | 2 | 12.9 |
| 5165 | 19 | 1 | 29.9 |
| 5166 | 5 | 1 | 34.9 |
| 5166 | 8 | 1 | 19.9 |
| 5167 | 2 | 1 | 14.9 |
| 5168 | 5 | 1 | 34.9 |
| 5169 | 24 | 1 | 129 |
| 5170 | 17 | 1 | 119 |
| 5170 | 18 | 3 | 9.9 |
| 5171 | 3 | 1 | 24.9 |
| 5172 | 12 | 1 | 44.9 |
| 5173 | 3 | 1 | 24.9 |
| 5173 | 24 | 1 | 129 |
| 5174 | 16 | 1 | 99.9 |
| 5175 | 24 | 1 | 129 |
| 5176 | 7 | 1 | 49.9 |
| 5177 | 21 | 1 | 19.9 |
| 5178 | 1 | 1 | 89.9 |
| 5178 | 4 | 1 | 12.9 |
| 5179 | 1 | 1 | 89.9 |
| 5179 | 2 | 2 | 14.9 |
| 5180 | 18 | 3 | 9.9 |
| 5181 | 4 | 1 | 12.9 |
| 5182 | 16 | 1 | 99.9 |
| 5183 | 24 | 1 | 129 |
| 5184 | 3 | 1 | 24.9 |
| 5185 | 16 | 1 | 99.9 |
| 5186 | 17 | 1 | 119 |
| 5186 | 23 | 1 | 39.9 |
| 5187 | 7 | 1 | 49.9 |
| 5187 | 8 | 1 | 19.9 |
| 5187 | 12 | 1 | 44.9 |
| 5188 | 23 | 1 | 39.9 |
| 5189 | 21 | 1 | 19.9 |
| 5190 | 7 | 1 | 49.9 |
| 5191 | 17 | 1 | 119 |
| 5191 | 18 | 3 | 9.9 |
| 5192 | 5 | 1 | 34.9 |
| 5193 | 5 | 1 | 34.9 |
| 5194 | 13 | 1 | 79.9 |
| 5195 | 14 | 2 | 16.9 |
| 5196 | 8 | 1 | 19.9 |
| 5197 | 15 | 1 | 27.9 |
| 5198 | 16 | 1 | 99.9 |
| 5199 | 19 | 1 | 29.9 |
| 5200 | 17 | 1 | 119 |
| 5201 | 1 | 1 | 89.9 |
| 5201 | 4 | 1 | 12.9 |
| 5202 | 1 | 1 | 89.9 |
| 5203 | 5 | 1 | 34.9 |
| 5203 | 6 | 1 | 12.9 |
| 5204 | 15 | 1 | 27.9 |
| 5205 | 12 | 1 | 44.9 |
| 5206 | 10 | 1 | 59.9 |
| 5206 | 11 | 1 | 29.9 |
| 5207 | 1 | 1 | 89.9 |
| 5207 | 4 | 1 | 12.9 |
| 5207 | 23 | 1 | 39.9 |
| 5208 | 13 | 1 | 79.9 |
| 5208 | 14 | 2 | 16.9 |
| 5209 | 16 | 1 | 99.9 |
| 5210 | 2 | 2 | 14.9 |
| 5211 | 21 | 1 | 19.9 |
| 5212 | 2 | 2 | 14.9 |
| 5212 | 6 | 1 | 12.9 |
| 5213 | 19 | 1 | 29.9 |
| 5214 | 2 | 2 | 14.9 |
| 5215 | 3 | 1 | 24.9 |
| 5216 | 1 | 1 | 89.9 |
| 5217 | 21 | 1 | 19.9 |
| 5218 | 13 | 1 | 79.9 |
| 5218 | 14 | 1 | 16.9 |
| 5219 | 1 | 1 | 89.9 |
| 5220 | 12 | 1 | 44.9 |
| 5221 | 1 | 1 | 89.9 |
| 5222 | 1 | 1 | 89.9 |
| 5223 | 1 | 1 | 89.9 |
| 5224 | 4 | 2 | 12.9 |
| 5225 | 7 | 1 | 49.9 |
| 5226 | 3 | 1 | 24.9 |
| 5227 | 15 | 1 | 27.9 |
| 5228 | 19 | 1 | 29.9 |
| 5229 | 9 | 1 | 24.9 |
| 5230 | 9 | 1 | 24.9 |
| 5231 | 9 | 1 | 24.9 |
| 5232 | 7 | 1 | 49.9 |
| 5233 | 2 | 1 | 14.9 |
| 5234 | 3 | 1 | 24.9 |
| 5235 | 5 | 1 | 34.9 |
| 5236 | 5 | 1 | 34.9 |
| 5237 | 10 | 1 | 59.9 |
| 5237 | 11 | 1 | 29.9 |
| 5238 | 8 | 1 | 19.9 |
| 5239 | 1 | 1 | 89.9 |
| 5239 | 2 | 1 | 14.9 |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
13. Expenses by account in Q1
Task For the quarterly report, finance needs expenses per account. For every account of type 'expense', show account_id, name and expenses: the sum of debit minus credit from all ledger entries from 1 January up to and including 31 March 2026, rounded to 2 decimal places. Highest expenses first.
accounts 13 rows, 3 columns
| account_id | name | type |
|---|---|---|
| 1000 | Bank | asset |
| 1100 | Accounts receivable | asset |
| 2000 | Accounts payable | liability |
| 3000 | Equity | equity |
| 4000 | Sales revenue | revenue |
| 5000 | Materials | expense |
| 6000 | Salaries and wages | expense |
| 6100 | Rent and occupancy | expense |
| 6200 | Energy | expense |
| 6300 | Travel | expense |
| 6400 | Advertising | expense |
| 6500 | IT and software | expense |
| 6600 | Repairs and maintenance | expense |
ledger 169 rows, 8 columns
| entry_id | doc_no | entry_date | account_id | cost_center_id | description | debit | credit |
|---|---|---|---|---|---|---|---|
| 1 | 1001 | 2026-01-01 | 1000 | NULL | Opening balance bank | 320000 | 0 |
| 2 | 1001 | 2026-01-01 | 3000 | NULL | Opening balance bank | 0 | 320000 |
| 3 | 1002 | 2026-01-03 | 6100 | 2000 | Rent January | 6800 | 0 |
| 4 | 1002 | 2026-01-03 | 6100 | 1000 | Rent January | 4600 | 0 |
| 5 | 1002 | 2026-01-03 | 1000 | NULL | Rent January | 0 | 11400 |
| 6 | 1003 | 2026-01-05 | 6500 | 1200 | Software licences quarter | 4860 | 0 |
| 7 | 1003 | 2026-01-05 | 2000 | NULL | Software licences quarter | 0 | 4860 |
| 8 | 1004 | 2026-01-08 | 5000 | 2000 | Materials purchase | 56177.71 | 0 |
| 9 | 1004 | 2026-01-08 | 5000 | 2100 | Materials purchase | 34355.83 | 0 |
| 10 | 1004 | 2026-01-08 | 2000 | NULL | Materials purchase | 0 | 90533.54 |
| 11 | 1005 | 2026-01-20 | 6200 | 2000 | Electricity and gas | 3416.46 | 0 |
| 12 | 1005 | 2026-01-20 | 2000 | NULL | Electricity and gas | 0 | 3416.46 |
| 13 | 1006 | 2026-01-28 | 6000 | 1000 | Payroll | 14469.07 | 0 |
| 14 | 1006 | 2026-01-28 | 6000 | 1100 | Payroll | 11248.67 | 0 |
| 15 | 1006 | 2026-01-28 | 6000 | 1200 | Payroll | 7764.75 | 0 |
| 16 | 1006 | 2026-01-28 | 6000 | 2000 | Payroll | 24648.2 | 0 |
| 17 | 1006 | 2026-01-28 | 6000 | 2100 | Payroll | 19865.04 | 0 |
| 18 | 1006 | 2026-01-28 | 6000 | 2200 | Payroll | 9919.49 | 0 |
| 19 | 1006 | 2026-01-28 | 6000 | 3000 | Payroll | 13339.13 | 0 |
| 20 | 1006 | 2026-01-28 | 6000 | 3100 | Payroll | 6905.66 | 0 |
| 21 | 1006 | 2026-01-28 | 1000 | NULL | Payroll | 0 | 108160.01 |
| 22 | 1007 | 2026-01-31 | 1100 | NULL | Sales invoices | 190302.72 | 0 |
| 23 | 1007 | 2026-01-31 | 4000 | NULL | Sales invoices | 0 | 190302.72 |
| 24 | 1008 | 2026-01-31 | 1000 | NULL | Customer receipts | 41681.77 | 0 |
| 25 | 1008 | 2026-01-31 | 1100 | NULL | Customer receipts | 0 | 41681.77 |
| 26 | 1009 | 2026-02-03 | 6100 | 2000 | Rent February | 6800 | 0 |
| 27 | 1009 | 2026-02-03 | 6100 | 1000 | Rent February | 4600 | 0 |
| 28 | 1009 | 2026-02-03 | 1000 | NULL | Rent February | 0 | 11400 |
| 29 | 1010 | 2026-02-08 | 5000 | 2000 | Materials purchase | 73668.51 | 0 |
| 30 | 1010 | 2026-02-08 | 5000 | 2100 | Materials purchase | 44273.2 | 0 |
| 31 | 1010 | 2026-02-08 | 2000 | NULL | Materials purchase | 0 | 117941.71 |
| 32 | 1011 | 2026-02-10 | 2000 | NULL | Supplier payments | 98810 | 0 |
| 33 | 1011 | 2026-02-10 | 1000 | NULL | Supplier payments | 0 | 98810 |
| 34 | 1012 | 2026-02-12 | 6400 | 3100 | Ads | 4200 | 0 |
| 35 | 1012 | 2026-02-12 | 2000 | NULL | Ads | 0 | 4200 |
| 36 | 1013 | 2026-02-20 | 6200 | 2000 | Electricity and gas | 3671.31 | 0 |
| 37 | 1013 | 2026-02-20 | 2000 | NULL | Electricity and gas | 0 | 3671.31 |
| 38 | 1014 | 2026-02-25 | 6300 | 3000 | Sales travel expenses | 1286.4 | 0 |
| 39 | 1014 | 2026-02-25 | 1000 | NULL | Sales travel expenses | 0 | 1286.4 |
| 40 | 1015 | 2026-02-28 | 6000 | 1000 | Payroll | 14564.78 | 0 |
| 41 | 1015 | 2026-02-28 | 6000 | 1100 | Payroll | 11248.62 | 0 |
| 42 | 1015 | 2026-02-28 | 6000 | 1200 | Payroll | 7830.19 | 0 |
| 43 | 1015 | 2026-02-28 | 6000 | 2000 | Payroll | 24669.51 | 0 |
| 44 | 1015 | 2026-02-28 | 6000 | 2100 | Payroll | 19869.44 | 0 |
| 45 | 1015 | 2026-02-28 | 6000 | 2200 | Payroll | 9893.72 | 0 |
| 46 | 1015 | 2026-02-28 | 6000 | 3000 | Payroll | 13366.23 | 0 |
| 47 | 1015 | 2026-02-28 | 6000 | 3100 | Payroll | 6921.81 | 0 |
| 48 | 1015 | 2026-02-28 | 1000 | NULL | Payroll | 0 | 108364.3 |
| 49 | 1016 | 2026-02-28 | 1100 | NULL | Sales invoices | 249339.75 | 0 |
| 50 | 1016 | 2026-02-28 | 4000 | NULL | Sales invoices | 0 | 249339.75 |
| 51 | 1017 | 2026-02-28 | 1000 | NULL | Customer receipts | 77712.92 | 0 |
| 52 | 1017 | 2026-02-28 | 1100 | NULL | Customer receipts | 0 | 77712.92 |
| 53 | 1018 | 2026-03-03 | 6100 | 2000 | Rent March | 6800 | 0 |
| 54 | 1018 | 2026-03-03 | 6100 | 1000 | Rent March | 4600 | 0 |
| 55 | 1018 | 2026-03-03 | 1000 | NULL | Rent March | 0 | 11400 |
| 56 | 1019 | 2026-03-05 | 6500 | 1200 | Laptop hardware | 3290 | 0 |
| 57 | 1019 | 2026-03-05 | 2000 | NULL | Laptop hardware | 0 | 3290 |
| 58 | 1020 | 2026-03-08 | 5000 | 2000 | Materials purchase | 110523.12 | 0 |
| 59 | 1020 | 2026-03-08 | 5000 | 2100 | Materials purchase | 67928.04 | 0 |
| 60 | 1020 | 2026-03-08 | 2000 | NULL | Materials purchase | 0 | 178451.16 |
| 61 | 1021 | 2026-03-10 | 2000 | NULL | Supplier payments | 125813.02 | 0 |
| 62 | 1021 | 2026-03-10 | 1000 | NULL | Supplier payments | 0 | 125813.02 |
| 63 | 1022 | 2026-03-12 | 6400 | 3100 | Spring campaign | 18600 | 0 |
| 64 | 1022 | 2026-03-12 | 2000 | NULL | Spring campaign | 0 | 18600 |
| 65 | 1023 | 2026-03-20 | 6200 | 2000 | Electricity and gas | 3929.91 | 0 |
| 66 | 1023 | 2026-03-20 | 2000 | NULL | Electricity and gas | 0 | 3929.91 |
| 67 | 1024 | 2026-03-22 | 6600 | 2000 | Machine service | 2480 | 0 |
| 68 | 1024 | 2026-03-22 | 2000 | NULL | Machine service | 0 | 2480 |
| 69 | 1025 | 2026-03-26 | 2000 | NULL | Supplier credit note return | 1240 | 0 |
| 70 | 1025 | 2026-03-26 | 5000 | 2000 | Supplier credit note return | 0 | 1240 |
| 71 | 1026 | 2026-03-28 | 6000 | 1000 | Payroll | 14521.48 | 0 |
| 72 | 1026 | 2026-03-28 | 6000 | 1100 | Payroll | 11254.45 | 0 |
| 73 | 1026 | 2026-03-28 | 6000 | 1200 | Payroll | 7770.97 | 0 |
| 74 | 1026 | 2026-03-28 | 6000 | 2000 | Payroll | 24522.86 | 0 |
| 75 | 1026 | 2026-03-28 | 6000 | 2100 | Payroll | 19761.5 | 0 |
| 76 | 1026 | 2026-03-28 | 6000 | 2200 | Payroll | 9898.42 | 0 |
| 77 | 1026 | 2026-03-28 | 6000 | 3000 | Payroll | 16593.37 | 0 |
| 78 | 1026 | 2026-03-28 | 6000 | 3100 | Payroll | 6919.28 | 0 |
| 79 | 1026 | 2026-03-28 | 1000 | NULL | Payroll | 0 | 111242.33 |
| 80 | 1027 | 2026-03-31 | 1100 | NULL | Sales invoices | 375915.93 | 0 |
| 81 | 1027 | 2026-03-31 | 4000 | NULL | Sales invoices | 0 | 375915.93 |
| 82 | 1028 | 2026-03-31 | 1000 | NULL | Customer receipts | 297540.71 | 0 |
| 83 | 1028 | 2026-03-31 | 1100 | NULL | Customer receipts | 0 | 297540.71 |
| 84 | 1029 | 2026-04-03 | 6100 | 2000 | Rent April | 6800 | 0 |
| 85 | 1029 | 2026-04-03 | 6100 | 1000 | Rent April | 4600 | 0 |
| 86 | 1029 | 2026-04-03 | 1000 | NULL | Rent April | 0 | 11400 |
| 87 | 1030 | 2026-04-05 | 6500 | 1200 | Software licences quarter | 4860 | 0 |
| 88 | 1030 | 2026-04-05 | 2000 | NULL | Software licences quarter | 0 | 4860 |
| 89 | 1031 | 2026-04-08 | 5000 | 2000 | Materials purchase | 132153.91 | 0 |
| 90 | 1031 | 2026-04-08 | 5000 | 2100 | Materials purchase | 84705.12 | 0 |
| 91 | 1031 | 2026-04-08 | 2000 | NULL | Materials purchase | 0 | 216859.03 |
| 92 | 1032 | 2026-04-10 | 2000 | NULL | Supplier payments | 205511.07 | 0 |
| 93 | 1032 | 2026-04-10 | 1000 | NULL | Supplier payments | 0 | 205511.07 |
| 94 | 1033 | 2026-04-12 | 6400 | 3100 | Spring campaign | 21400 | 0 |
| 95 | 1033 | 2026-04-12 | 2000 | NULL | Spring campaign | 0 | 21400 |
| 96 | 1034 | 2026-04-20 | 6200 | 2000 | Electricity and gas | 4275.47 | 0 |
| 97 | 1034 | 2026-04-20 | 2000 | NULL | Electricity and gas | 0 | 4275.47 |
| 98 | 1035 | 2026-04-25 | 6300 | 3000 | Sales travel expenses | 2914.7 | 0 |
| 99 | 1035 | 2026-04-25 | 1000 | NULL | Sales travel expenses | 0 | 2914.7 |
| 100 | 1036 | 2026-04-28 | 6000 | 1000 | Payroll | 14511.12 | 0 |
| 101 | 1036 | 2026-04-28 | 6000 | 1100 | Payroll | 11250.53 | 0 |
| 102 | 1036 | 2026-04-28 | 6000 | 1200 | Payroll | 7799.38 | 0 |
| 103 | 1036 | 2026-04-28 | 6000 | 2000 | Payroll | 24704.1 | 0 |
| 104 | 1036 | 2026-04-28 | 6000 | 2100 | Payroll | 22185.09 | 0 |
| 105 | 1036 | 2026-04-28 | 6000 | 2200 | Payroll | 9945.03 | 0 |
| 106 | 1036 | 2026-04-28 | 6000 | 3000 | Payroll | 13372.53 | 0 |
| 107 | 1036 | 2026-04-28 | 6000 | 3100 | Payroll | 6882.32 | 0 |
| 108 | 1036 | 2026-04-28 | 1000 | NULL | Payroll | 0 | 110650.1 |
| 109 | 1037 | 2026-04-30 | 1100 | NULL | Sales invoices | 452137.92 | 0 |
| 110 | 1037 | 2026-04-30 | 4000 | NULL | Sales invoices | 0 | 452137.92 |
| 111 | 1038 | 2026-04-30 | 1000 | NULL | Customer receipts | 235601.59 | 0 |
| 112 | 1038 | 2026-04-30 | 1100 | NULL | Customer receipts | 0 | 235601.59 |
| 113 | 1039 | 2026-05-03 | 6100 | 2000 | Rent May | 6800 | 0 |
| 114 | 1039 | 2026-05-03 | 6100 | 1000 | Rent May | 4600 | 0 |
| 115 | 1039 | 2026-05-03 | 1000 | NULL | Rent May | 0 | 11400 |
| 116 | 1040 | 2026-05-08 | 5000 | 2000 | Materials purchase | 141737.72 | 0 |
| 117 | 1040 | 2026-05-08 | 5000 | 2100 | Materials purchase | 82231.25 | 0 |
| 118 | 1040 | 2026-05-08 | 2000 | NULL | Materials purchase | 0 | 223968.97 |
| 119 | 1041 | 2026-05-10 | 2000 | NULL | Supplier payments | 247394.5 | 0 |
| 120 | 1041 | 2026-05-10 | 1000 | NULL | Supplier payments | 0 | 247394.5 |
| 121 | 1042 | 2026-05-12 | 6400 | 3100 | Ads | 6300 | 0 |
| 122 | 1042 | 2026-05-12 | 2000 | NULL | Ads | 0 | 6300 |
| 123 | 1043 | 2026-05-20 | 6200 | 2000 | Electricity and gas | 4015.69 | 0 |
| 124 | 1043 | 2026-05-20 | 2000 | NULL | Electricity and gas | 0 | 4015.69 |
| 125 | 1044 | 2026-05-27 | 2000 | NULL | Agency credit note | 1850 | 0 |
| 126 | 1044 | 2026-05-27 | 6400 | 3100 | Agency credit note | 0 | 1850 |
| 127 | 1045 | 2026-05-28 | 6000 | 1000 | Payroll | 14460.25 | 0 |
| 128 | 1045 | 2026-05-28 | 6000 | 1100 | Payroll | 11220.17 | 0 |
| 129 | 1045 | 2026-05-28 | 6000 | 1200 | Payroll | 7803.77 | 0 |
| 130 | 1045 | 2026-05-28 | 6000 | 2000 | Payroll | 24549.87 | 0 |
| 131 | 1045 | 2026-05-28 | 6000 | 2100 | Payroll | 22845.09 | 0 |
| 132 | 1045 | 2026-05-28 | 6000 | 2200 | Payroll | 9873.46 | 0 |
| 133 | 1045 | 2026-05-28 | 6000 | 3000 | Payroll | 13377.78 | 0 |
| 134 | 1045 | 2026-05-28 | 6000 | 3100 | Payroll | 6876.77 | 0 |
| 135 | 1045 | 2026-05-28 | 1000 | NULL | Payroll | 0 | 111007.16 |
| 136 | 1046 | 2026-05-31 | 1100 | NULL | Sales invoices | 437876.58 | 0 |
| 137 | 1046 | 2026-05-31 | 4000 | NULL | Sales invoices | 0 | 437876.58 |
| 138 | 1047 | 2026-05-31 | 1000 | NULL | Customer receipts | 396656.49 | 0 |
| 139 | 1047 | 2026-05-31 | 1100 | NULL | Customer receipts | 0 | 396656.49 |
| 140 | 1048 | 2026-06-03 | 6100 | 2000 | Rent June | 6800 | 0 |
| 141 | 1048 | 2026-06-03 | 6100 | 1000 | Rent June | 4600 | 0 |
| 142 | 1048 | 2026-06-03 | 1000 | NULL | Rent June | 0 | 11400 |
| 143 | 1049 | 2026-06-05 | 6500 | 1200 | Laptop hardware | 2140 | 0 |
| 144 | 1050 | 2026-06-08 | 5000 | 2000 | Materials purchase | 100972.77 | 0 |
| 145 | 1050 | 2026-06-08 | 5000 | 2100 | Materials purchase | 65827.08 | 0 |
| 146 | 1050 | 2026-06-08 | 2000 | NULL | Materials purchase | 0 | 166529.85 |
| 147 | 1051 | 2026-06-10 | 2000 | NULL | Supplier payments | 232434.66 | 0 |
| 148 | 1051 | 2026-06-10 | 1000 | NULL | Supplier payments | 0 | 232434.66 |
| 149 | 1052 | 2026-06-12 | 6400 | 3100 | Ads | 5100 | 0 |
| 150 | 1052 | 2026-06-12 | 2000 | NULL | Ads | 0 | 5100 |
| 151 | 1053 | 2026-06-20 | 6200 | 2000 | Electricity and gas | 3998.69 | 0 |
| 152 | 1053 | 2026-06-20 | 2000 | NULL | Electricity and gas | 0 | 3998.69 |
| 153 | 1054 | 2026-06-22 | 6600 | NULL | Machine service | 3960 | 0 |
| 154 | 1054 | 2026-06-22 | 2000 | NULL | Machine service | 0 | 3960 |
| 155 | 1055 | 2026-06-25 | 6300 | NULL | Sales travel expenses | 1742.3 | 0 |
| 156 | 1055 | 2026-06-25 | 1000 | NULL | Sales travel expenses | 0 | 1742.3 |
| 157 | 1056 | 2026-06-28 | 6000 | 1000 | Payroll | 14454.64 | 0 |
| 158 | 1056 | 2026-06-28 | 6000 | 1100 | Payroll | 11163.23 | 0 |
| 159 | 1056 | 2026-06-28 | 6000 | 1200 | Payroll | 7807.76 | 0 |
| 160 | 1056 | 2026-06-28 | 6000 | 2000 | Payroll | 24532.24 | 0 |
| 161 | 1056 | 2026-06-28 | 6000 | 2100 | Payroll | 19864.73 | 0 |
| 162 | 1056 | 2026-06-28 | 6000 | 2200 | Payroll | 9885.93 | 0 |
| 163 | 1056 | 2026-06-28 | 6000 | 3000 | Payroll | 13419.99 | 0 |
| 164 | 1056 | 2026-06-28 | 6000 | 3100 | Payroll | 6874.02 | 0 |
| 165 | 1056 | 2026-06-28 | 1000 | NULL | Payroll | 0 | 108002.54 |
| 166 | 1057 | 2026-06-30 | 1100 | NULL | Sales invoices | 293910.52 | 0 |
| 167 | 1057 | 2026-06-30 | 4000 | NULL | Sales invoices | 0 | 293910.52 |
| 168 | 1058 | 2026-06-30 | 1000 | NULL | Customer receipts | 416664.2 | 0 |
| 169 | 1058 | 2026-06-30 | 1100 | NULL | Customer receipts | 0 | 416664.2 |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
14. Order size bands
Task Put the orders that aren't cancelled into three size bands by amount: 'small' below 50, 'medium' from 50 and below 150, 'large' from 150. Show band, orders and revenue (sum of amount, 2 decimal places), in the order small, medium, large.
orders 122 rows, 5 columns
| order_id | customer_id | order_date | status | amount |
|---|---|---|---|---|
| 5001 | 2 | 2025-11-01 | cancelled | 93.9 |
| 5002 | 4 | 2025-11-02 | delivered | 238.8 |
| 5003 | 6 | 2025-11-08 | delivered | 14.9 |
| 5004 | 3 | 2025-11-10 | delivered | 29.9 |
| 5005 | 7 | 2025-11-11 | delivered | 44.9 |
| 5006 | 5 | 2025-11-13 | delivered | 104.7 |
| 5007 | 11 | 2025-11-16 | delivered | 17.9 |
| 5008 | 13 | 2025-11-17 | delivered | 119 |
| 5009 | 9 | 2025-11-18 | delivered | 206.8 |
| 5010 | 10 | 2025-11-20 | delivered | 758 |
| 5011 | 12 | 2025-11-23 | delivered | 44.9 |
| 5012 | 1 | 2025-11-25 | delivered | 77.8 |
| 5013 | 4 | 2025-11-27 | delivered | 149 |
| 5014 | 8 | 2025-11-28 | delivered | 39.9 |
| 5015 | 10 | 2025-12-15 | delivered | 777.9 |
| 5016 | 14 | 2025-12-16 | delivered | 55.8 |
| 5017 | 2 | 2025-12-22 | delivered | 34.9 |
| 5018 | 16 | 2025-12-22 | delivered | 79 |
| 5019 | 15 | 2025-12-29 | delivered | 22.9 |
| 5020 | 20 | 2025-12-29 | delivered | 59.8 |
| 5021 | 21 | 2025-12-30 | delivered | 379 |
| 5022 | 19 | 2025-12-31 | delivered | 114.7 |
| 5023 | 17 | 2026-01-03 | delivered | 49.8 |
| 5024 | 18 | 2026-01-08 | delivered | 79 |
| 5025 | 6 | 2026-01-14 | delivered | 44.9 |
| 5026 | 11 | 2026-01-16 | delivered | 12.9 |
| 5027 | 9 | 2026-01-17 | delivered | 49.9 |
| 5028 | 2 | 2026-01-21 | delivered | 59.9 |
| 5029 | 22 | 2026-01-24 | delivered | 49.9 |
| 5030 | 24 | 2026-01-25 | delivered | 498 |
| 5031 | 25 | 2026-02-04 | delivered | 413.9 |
| 5032 | 5 | 2026-02-05 | delivered | 34.9 |
| 5033 | 28 | 2026-02-06 | cancelled | 34.9 |
| 5034 | 26 | 2026-02-11 | delivered | 17.9 |
| 5035 | 11 | 2026-02-20 | delivered | 39.9 |
| 5036 | 21 | 2026-02-23 | delivered | 170.9 |
| 5037 | 29 | 2026-02-25 | delivered | 49.9 |
| 5038 | 27 | 2026-02-26 | delivered | 24.9 |
| 5039 | 12 | 2026-03-03 | delivered | 308 |
| 5040 | 18 | 2026-03-03 | delivered | 26.9 |
| 5041 | 15 | 2026-03-06 | delivered | 99.6 |
| 5042 | 1 | 2026-03-07 | delivered | 403.8 |
| 5043 | 31 | 2026-03-11 | delivered | 417.7 |
| 5044 | 30 | 2026-03-12 | delivered | 149 |
| 5045 | 33 | 2026-03-13 | delivered | 158 |
| 5046 | 34 | 2026-03-19 | delivered | 189 |
| 5047 | 32 | 2026-03-27 | delivered | 123.8 |
| 5048 | 35 | 2026-03-30 | delivered | 93.9 |
| 5049 | 19 | 2026-04-01 | delivered | 69.8 |
| 5050 | 2 | 2026-04-04 | cancelled | 368.9 |
| 5051 | 34 | 2026-04-06 | delivered | 47.8 |
| 5052 | 20 | 2026-04-16 | delivered | 119 |
| 5053 | 6 | 2026-04-22 | delivered | 258.7 |
| 5054 | 2 | 2026-04-23 | cancelled | 126.7 |
| 5055 | 11 | 2026-04-24 | delivered | 29.9 |
| 5056 | 36 | 2026-04-26 | delivered | 79 |
| 5057 | 37 | 2026-04-26 | cancelled | 12.9 |
| 5058 | 39 | 2026-04-27 | delivered | 117.7 |
| 5059 | 38 | 2026-04-29 | delivered | 19.9 |
| 5060 | 22 | 2026-04-30 | delivered | 59.9 |
| 5061 | 99 | 2026-05-01 | delivered | 63.7 |
| 5062 | 40 | 2026-05-04 | delivered | 158 |
| 5063 | 41 | 2026-05-05 | delivered | 378 |
| 5064 | 29 | 2026-05-14 | delivered | 228.7 |
| 5065 | 43 | 2026-05-17 | delivered | 74.7 |
| 5066 | 45 | 2026-05-25 | cancelled | 39.9 |
| 5067 | 44 | 2026-05-27 | delivered | 69.8 |
| 5068 | 46 | 2026-05-31 | delivered | 80.7 |
| 5069 | 27 | 2026-06-04 | delivered | 97.7 |
| 5070 | 31 | 2026-06-09 | delivered | 68.7 |
| 5071 | 18 | 2026-06-10 | delivered | 189 |
| 5072 | 19 | 2026-06-11 | delivered | 57.7 |
| 5073 | 35 | 2026-06-13 | delivered | 149 |
| 5074 | 47 | 2026-06-19 | delivered | 119 |
| 5075 | 49 | 2026-06-20 | delivered | 39.9 |
| 5076 | 48 | 2026-06-23 | delivered | 49.9 |
| 5077 | 42 | 2026-06-25 | delivered | 19.9 |
| 5078 | 51 | 2026-06-27 | delivered | 34.9 |
| 5079 | 39 | 2026-07-01 | delivered | 59.7 |
| 5080 | 50 | 2026-07-01 | delivered | 25.8 |
| 5081 | 45 | 2026-07-02 | delivered | 188.8 |
| 5082 | 19 | 2026-07-04 | delivered | 134.4 |
| 5083 | 53 | 2026-07-12 | delivered | 83.7 |
| 5084 | 52 | 2026-07-14 | delivered | 77.8 |
| 5085 | 38 | 2026-07-15 | delivered | 129.7 |
| 5086 | 54 | 2026-07-15 | delivered | 418.8 |
| 5087 | 46 | 2026-07-17 | delivered | 59.8 |
| 5088 | 29 | 2026-07-19 | delivered | 188.9 |
| 5089 | 36 | 2026-07-19 | delivered | 124.7 |
| 5090 | 45 | 2026-07-27 | delivered | 14.9 |
| 5091 | 41 | 2026-07-29 | delivered | 19.9 |
| 5092 | 58 | 2026-08-01 | delivered | 99.8 |
| 5093 | 56 | 2026-08-05 | delivered | 74.7 |
| 5094 | 53 | 2026-08-06 | delivered | 98.9 |
| 5095 | 59 | 2026-08-07 | delivered | 22.9 |
| 5096 | 18 | 2026-08-12 | delivered | 1157 |
| 5097 | 61 | 2026-08-16 | delivered | 44.7 |
| 5098 | 29 | 2026-08-20 | delivered | 105.7 |
| 5099 | 60 | 2026-08-24 | delivered | 307 |
| 5100 | 39 | 2026-08-27 | delivered | 103.9 |
| 5101 | 44 | 2026-08-28 | delivered | 243.8 |
| 5102 | 31 | 2026-08-31 | delivered | 128.9 |
| 5103 | 54 | 2026-08-31 | delivered | 298 |
| 5104 | 42 | 2026-09-01 | delivered | 388.9 |
| 5105 | 47 | 2026-09-01 | delivered | 124.7 |
| 5106 | 63 | 2026-09-06 | cancelled | 14.9 |
| 5107 | 64 | 2026-09-06 | delivered | 62.8 |
| 5108 | 65 | 2026-09-06 | cancelled | 208.6 |
| 5109 | 62 | 2026-09-11 | delivered | 34.9 |
| 5110 | 27 | 2026-09-18 | delivered | 29.9 |
| 5111 | 42 | 2026-09-20 | delivered | 104.7 |
| 5112 | 41 | 2026-09-21 | delivered | 24.9 |
| 5113 | 46 | 2026-09-27 | delivered | 94.6 |
| 5114 | 66 | 2026-09-28 | delivered | 29.9 |
| 5115 | 67 | 2026-10-01 | delivered | 34.9 |
| 5116 | 51 | 2026-10-07 | delivered | 69.8 |
| 5117 | 53 | 2026-10-07 | cancelled | 34.9 |
| 5118 | 70 | 2026-10-09 | delivered | 211.9 |
| 5119 | 64 | 2026-10-16 | delivered | 698 |
| 5120 | 68 | 2026-10-21 | delivered | 183.9 |
| 5121 | 69 | 2026-10-27 | shipped | 159.4 |
| 5122 | 27 | 2026-10-30 | shipped | 118.9 |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
15. Customers per city, including no city
Task To plan regional advertising, marketing counts customers per city. Customers with no city should be counted as 'unknown' rather than dropped. Show city and customers, most customers first, then alphabetically by city for ties.
customers 70 rows, 6 columns
| customer_id | name | city | signup_date | channel | |
|---|---|---|---|---|---|
| 1 | Samuel Ward | samuel.ward@example.com | Austin | 2025-10-07 | Newsletter |
| 2 | Owen Robinson | owen.robinson@example.com | Denver | 2025-08-02 | Referral |
| 3 | Liam Martin | liam.martin@example.com | Chicago | 2025-09-17 | Search |
| 4 | Thomas Hughes | thomas.hughes@example.com | Bristol | 2025-09-07 | Search |
| 5 | Chloe Lewis | chloe.lewis@example.com | Bristol | 2025-09-03 | Newsletter |
| 6 | Connor Hall | connor.hall@example.com | New York | 2025-07-07 | Referral |
| 7 | Lily Robinson | lily.robinson@example.com | Glasgow | 2025-07-31 | Newsletter |
| 8 | James Thomas | james.thomas@example.com | Glasgow | 2025-07-02 | Search |
| 9 | Aisha Green | aisha.green@example.com | Chicago | 2025-07-16 | Newsletter |
| 10 | Sophia Murphy | sophia.murphy@example.com | Birmingham | 2025-08-03 | Search |
| 11 | Emily Harris | emily.harris@example.com | Leeds | 2025-11-08 | Search |
| 12 | Hannah Thomas | hannah.thomas@example.com | NULL | 2025-11-16 | Search |
| 13 | Ethan Hall | ethan.hall@example.com | Austin | 2025-11-13 | Search |
| 14 | Lucas Price | lucas.price@example.com | Leeds | 2025-11-26 | Newsletter |
| 15 | Priya Harris | priya.harris@example.com | New York | 2025-12-05 | Newsletter |
| 16 | Lucas Reed | lucas.reed@example.com | Seattle | 2025-12-01 | Search |
| 17 | Fiona Campbell | fiona.campbell@example.com | Denver | 2025-12-11 | Search |
| 18 | Ryan Wright | ryan.wright@example.com | Chicago | 2025-12-14 | Social media |
| 19 | Priya Evans | priya.evans@example.com | Denver | 2025-12-26 | Search |
| 20 | Grace Campbell | grace.campbell@example.com | Denver | 2025-12-26 | Search |
| 21 | Aisha Price | aisha.price@example.com | New York | 2025-12-30 | Referral |
| 22 | Zoe Harris | zoe.harris@example.com | New York | 2026-01-11 | Newsletter |
| 23 | Liam Brown | liam.brown@example.com | Manchester | 2026-01-15 | Newsletter |
| 24 | Olivia Taylor | olivia.taylor@example.com | Denver | 2026-02-03 | Search |
| 25 | Aisha Wilson | aisha.wilson@example.com | Austin | 2026-02-13 | Search |
| 26 | Megan Reed | megan.reed@example.com | Glasgow | 2026-01-28 | Search |
| 27 | Amelia Green | NULL | Bristol | 2026-02-04 | Search |
| 28 | Kevin Wilson | kevin.wilson@example.com | Birmingham | 2026-02-06 | Search |
| 29 | Isla Morgan | isla.morgan@example.com | London | 2026-02-11 | Search |
| 30 | Liam Hall | liam.hall@example.com | Bristol | 2026-02-22 | Referral |
| 31 | Zoe Turner | zoe.turner@example.com | Birmingham | 2026-02-24 | Search |
| 32 | Daniel Evans | daniel.evans@example.com | Chicago | 2026-03-05 | Newsletter |
| 33 | Emily Wright | emily.wright@example.com | London | 2026-03-07 | Search |
| 34 | Connor Taylor | connor.taylor@example.com | Seattle | 2026-03-11 | Search |
| 35 | Olivia Reed | olivia.reed@example.com | New York | 2026-03-24 | Social media |
| 36 | Kevin Martin | kevin.martin@example.com | Birmingham | 2026-04-01 | Referral |
| 37 | Emily Davies | emily.davies@example.com | Austin | 2026-04-09 | Search |
| 38 | Ruby Johnson | ruby.johnson@example.com | NULL | 2026-04-08 | Social media |
| 39 | Henry Campbell | henry.campbell@example.com | Glasgow | 2026-04-10 | Newsletter |
| 40 | Ethan Murphy | ethan.murphy@example.com | Bristol | 2026-04-24 | Newsletter |
| 41 | Ethan Martin | ethan.martin@example.com | Manchester | 2026-05-01 | Referral |
| 42 | Liam Campbell | liam.campbell@example.com | Austin | 2026-04-30 | Search |
| 43 | Holly Harris | holly.harris@example.com | New York | 2026-05-10 | Search |
| 44 | Aaron Smith | aaron.smith@example.com | Manchester | 2026-05-13 | Newsletter |
| 45 | Aisha Baker | aisha.baker@example.com | Denver | 2026-05-19 | Social media |
| 46 | Isla Bennett | isla.bennett@example.com | Glasgow | 2026-05-18 | Social media |
| 47 | Chloe Davies | chloe.davies@example.com | Leeds | 2026-06-05 | Newsletter |
| 48 | Thomas Robinson | thomas.robinson@example.com | Boston | 2026-06-03 | Search |
| 49 | Marcus Evans | marcus.evans@example.com | Manchester | 2026-06-15 | Newsletter |
| 50 | Oliver Wright | oliver.wright@example.com | Bristol | 2026-06-10 | Search |
| 51 | Thomas Johnson | thomas.johnson@example.com | Glasgow | 2026-06-18 | Search |
| 52 | Sophia Reed | sophia.reed@example.com | London | 2026-06-24 | Search |
| 53 | Fiona Clarke | fiona.clarke@example.com | Leeds | 2026-07-02 | Referral |
| 54 | Liam Hall | LIAM.HALL@EXAMPLE.COM | Bristol | 2026-07-08 | Search |
| 55 | Lily Thomas | lily.thomas@example.com | Boston | 2026-07-14 | Search |
| 56 | Chloe Robinson | chloe.robinson@example.com | Bristol | 2026-07-26 | Search |
| 57 | Hannah Campbell | hannah.campbell@example.com | Boston | 2026-07-20 | Social media |
| 58 | Ruby Morgan | ruby.morgan@example.com | New York | 2026-07-29 | Search |
| 59 | Sophia Smith | sophia.smith@example.com | London | 2026-07-31 | Newsletter |
| 60 | Ava Martin | ava.martin@example.com | Birmingham | 2026-08-11 | Social media |
| 61 | Jack Hall | jack.hall@example.com | NULL | 2026-08-13 | Newsletter |
| 62 | Grace Cooper | grace.cooper@example.com | Chicago | 2026-08-25 | Search |
| 63 | Connor Price | connor.price@example.com | Manchester | 2026-08-23 | Search |
| 64 | Marcus Walker | marcus.walker@example.com | Bristol | 2026-09-04 | Social media |
| 65 | Holly Brown | holly.brown@example.com | Denver | 2026-09-06 | Search |
| 66 | Priya Evans | Priya.Evans@example.com | Denver | 2026-09-19 | Search |
| 67 | Carlos Garcia | carlos.garcia@example.com | Chicago | 2026-09-19 | Social media |
| 68 | Priya Thomas | priya.thomas@example.com | Bristol | 2026-09-29 | Search |
| 69 | Mia Reed | mia.reed@example.com | Chicago | 2026-10-02 | Search |
| 70 | Marcus Turner | marcus.turner@example.com | Boston | 2026-10-04 | Newsletter |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
16. Revenue by campaign, including none
Task How much revenue did the campaigns bring in during 2026? For all completed orders from 1 January 2026, show revenue (sum of amount, 2 decimal places) per campaign (the campaign name; orders without a campaign as 'no campaign'), highest revenue first.
orders 239 rows, 6 columns
| order_id | customer_id | order_date | campaign_id | status | amount |
|---|---|---|---|---|---|
| 5001 | 1 | 2025-01-16 | 1 | completed | 29.8 |
| 5002 | 2 | 2025-01-24 | NULL | completed | 139.7 |
| 5003 | 3 | 2025-01-28 | NULL | completed | 49.9 |
| 5004 | 4 | 2025-02-01 | 4 | completed | 69.8 |
| 5005 | 5 | 2025-02-07 | 3 | completed | 89.9 |
| 5006 | 6 | 2025-02-14 | NULL | completed | 24.9 |
| 5007 | 7 | 2025-02-25 | NULL | cancelled | 24.9 |
| 5008 | 8 | 2025-03-03 | 2 | completed | 139.7 |
| 5009 | 9 | 2025-03-06 | 2 | completed | 34.9 |
| 5010 | 6 | 2025-03-13 | NULL | completed | 24.9 |
| 5011 | 10 | 2025-03-15 | 2 | completed | 19.9 |
| 5012 | 11 | 2025-03-17 | NULL | completed | 49.9 |
| 5013 | 12 | 2025-03-29 | 3 | cancelled | 89.9 |
| 5014 | 13 | 2025-03-30 | 4 | completed | 24.9 |
| 5015 | 2 | 2025-04-03 | 3 | completed | 24.9 |
| 5016 | 14 | 2025-04-05 | 4 | completed | 79.9 |
| 5017 | 5 | 2025-04-06 | 3 | completed | 34.9 |
| 5018 | 10 | 2025-04-10 | NULL | completed | 89.9 |
| 5019 | 15 | 2025-04-12 | 3 | completed | 114.8 |
| 5020 | 16 | 2025-04-19 | 3 | completed | 99.9 |
| 5021 | 17 | 2025-04-26 | NULL | cancelled | 79.9 |
| 5022 | 7 | 2025-04-30 | NULL | completed | 29.9 |
| 5023 | 18 | 2025-05-03 | NULL | completed | 34.9 |
| 5024 | 19 | 2025-05-08 | NULL | completed | 89.9 |
| 5025 | 20 | 2025-05-12 | 3 | completed | 19.9 |
| 5026 | 21 | 2025-05-17 | 2 | cancelled | 39.9 |
| 5027 | 22 | 2025-05-18 | NULL | completed | 79.9 |
| 5028 | 14 | 2025-05-24 | 1 | completed | 89.9 |
| 5029 | 23 | 2025-05-25 | 1 | completed | 29.8 |
| 5030 | 16 | 2025-06-01 | 3 | cancelled | 27.9 |
| 5031 | 24 | 2025-06-01 | NULL | completed | 19.9 |
| 5032 | 25 | 2025-06-09 | 3 | completed | 79.9 |
| 5033 | 26 | 2025-06-15 | 6 | cancelled | 34.9 |
| 5034 | 27 | 2025-06-16 | 3 | completed | 24.9 |
| 5035 | 28 | 2025-06-18 | 6 | completed | 29.8 |
| 5036 | 29 | 2025-06-25 | 6 | completed | 19.9 |
| 5037 | 30 | 2025-07-06 | NULL | completed | 19.8 |
| 5038 | 31 | 2025-07-08 | 5 | completed | 24.9 |
| 5039 | 32 | 2025-07-10 | 5 | completed | 119.7 |
| 5040 | 33 | 2025-07-14 | 6 | completed | 49.9 |
| 5041 | 34 | 2025-07-24 | 6 | completed | 34.9 |
| 5042 | 35 | 2025-07-28 | 6 | cancelled | 89.9 |
| 5043 | 24 | 2025-07-29 | 3 | completed | 34.9 |
| 5044 | 36 | 2025-08-01 | 6 | completed | 104.8 |
| 5045 | 5 | 2025-08-05 | 3 | completed | 29.9 |
| 5046 | 37 | 2025-08-06 | NULL | cancelled | 119 |
| 5047 | 2 | 2025-08-07 | 3 | completed | 89.9 |
| 5048 | 38 | 2025-08-09 | NULL | completed | 9.9 |
| 5049 | 39 | 2025-08-14 | 6 | completed | 19.9 |
| 5050 | 40 | 2025-08-19 | 4 | completed | 89.9 |
| 5051 | 41 | 2025-08-29 | NULL | completed | 89.9 |
| 5052 | 42 | 2025-08-29 | 3 | completed | 12.9 |
| 5053 | 43 | 2025-09-03 | NULL | completed | 24.9 |
| 5054 | 44 | 2025-09-06 | 5 | completed | 34.9 |
| 5055 | 23 | 2025-09-07 | 5 | completed | 99.9 |
| 5056 | 38 | 2025-09-12 | 3 | completed | 25.8 |
| 5057 | 45 | 2025-09-15 | NULL | completed | 19.9 |
| 5058 | 46 | 2025-09-18 | 5 | completed | 99.9 |
| 5059 | 41 | 2025-09-19 | NULL | completed | 34.9 |
| 5060 | 47 | 2025-09-19 | NULL | completed | 9.9 |
| 5061 | 5 | 2025-09-24 | NULL | completed | 24.9 |
| 5062 | 48 | 2025-09-29 | NULL | completed | 79.9 |
| 5063 | 49 | 2025-09-29 | 5 | completed | 29.9 |
| 5064 | 50 | 2025-10-08 | NULL | completed | 129 |
| 5065 | 14 | 2025-10-10 | NULL | completed | 86.7 |
| 5066 | 51 | 2025-10-11 | 5 | completed | 119.7 |
| 5067 | 16 | 2025-10-12 | 5 | completed | 99.9 |
| 5068 | 52 | 2025-10-14 | 5 | completed | 119.7 |
| 5069 | 34 | 2025-10-19 | NULL | completed | 54.8 |
| 5070 | 21 | 2025-10-20 | NULL | completed | 49.9 |
| 5071 | 42 | 2025-10-20 | 5 | completed | 16.9 |
| 5072 | 53 | 2025-10-21 | 3 | completed | 89.9 |
| 5073 | 54 | 2025-10-24 | NULL | completed | 54.8 |
| 5074 | 55 | 2025-10-29 | 5 | completed | 99.9 |
| 5075 | 56 | 2025-11-04 | NULL | completed | 34.9 |
| 5076 | 57 | 2025-11-05 | 5 | completed | 114.8 |
| 5077 | 27 | 2025-11-07 | 3 | completed | 12.9 |
| 5078 | 31 | 2025-11-07 | NULL | completed | 59.9 |
| 5079 | 32 | 2025-11-07 | NULL | completed | 27.9 |
| 5080 | 58 | 2025-11-18 | NULL | completed | 19.9 |
| 5081 | 59 | 2025-11-23 | 5 | completed | 89.9 |
| 5082 | 60 | 2025-11-23 | 8 | completed | 25.8 |
| 5083 | 12 | 2025-11-24 | 7 | completed | 47.92 |
| 5084 | 15 | 2025-11-24 | 8 | completed | 91.84 |
| 5085 | 48 | 2025-11-24 | 7 | completed | 55.76 |
| 5086 | 51 | 2025-11-24 | 7 | completed | 23.92 |
| 5087 | 1 | 2025-11-25 | 7 | completed | 31.92 |
| 5088 | 7 | 2025-11-25 | NULL | completed | 47.92 |
| 5089 | 61 | 2025-11-25 | 3 | completed | 23.92 |
| 5090 | 6 | 2025-11-26 | 7 | completed | 39.92 |
| 5091 | 31 | 2025-11-26 | 8 | completed | 23.92 |
| 5092 | 56 | 2025-11-26 | 8 | completed | 10.32 |
| 5093 | 13 | 2025-11-27 | 7 | cancelled | 91.84 |
| 5094 | 30 | 2025-11-27 | 7 | completed | 31.92 |
| 5095 | 38 | 2025-11-28 | 7 | completed | 103.2 |
| 5096 | 55 | 2025-11-28 | 8 | completed | 63.92 |
| 5097 | 9 | 2025-11-29 | 8 | completed | 27.92 |
| 5098 | 5 | 2025-11-30 | 8 | completed | 15.84 |
| 5099 | 42 | 2025-11-30 | 3 | completed | 7.92 |
| 5100 | 44 | 2025-11-30 | 7 | completed | 48.56 |
| 5101 | 46 | 2025-11-30 | 7 | completed | 38.24 |
| 5102 | 47 | 2025-11-30 | 7 | completed | 31.92 |
| 5103 | 24 | 2025-12-01 | 7 | completed | 90.24 |
| 5104 | 62 | 2025-12-01 | 8 | completed | 15.92 |
| 5105 | 63 | 2025-12-08 | NULL | completed | 19.8 |
| 5106 | 64 | 2025-12-11 | NULL | completed | 114.8 |
| 5107 | 14 | 2025-12-12 | NULL | completed | 29.9 |
| 5108 | 65 | 2025-12-15 | 5 | completed | 89.7 |
| 5109 | 66 | 2025-12-19 | 5 | completed | 104.8 |
| 5110 | 67 | 2025-12-25 | NULL | completed | 34.9 |
| 5111 | 68 | 2025-12-26 | NULL | completed | 59.9 |
| 5112 | 42 | 2026-01-04 | NULL | completed | 79.9 |
| 5113 | 69 | 2026-01-06 | 10 | completed | 16.9 |
| 5114 | 70 | 2026-01-06 | 3 | completed | 19.9 |
| 5115 | 2 | 2026-01-09 | 9 | completed | 89.9 |
| 5116 | 71 | 2026-01-16 | 9 | completed | 25.8 |
| 5117 | 72 | 2026-01-17 | 9 | completed | 89.9 |
| 5118 | 50 | 2026-01-18 | NULL | completed | 19.9 |
| 5119 | 73 | 2026-01-23 | 10 | completed | 59.9 |
| 5120 | 74 | 2026-01-26 | NULL | completed | 19.8 |
| 5121 | 75 | 2026-02-02 | 9 | completed | 119 |
| 5122 | 76 | 2026-02-06 | 4 | completed | 24.9 |
| 5123 | 77 | 2026-02-07 | NULL | completed | 79.9 |
| 5124 | 78 | 2026-02-13 | NULL | completed | 9.9 |
| 5125 | 79 | 2026-02-15 | NULL | completed | 104.8 |
| 5126 | 74 | 2026-02-18 | NULL | completed | 49.9 |
| 5127 | 80 | 2026-02-20 | 4 | completed | 19.9 |
| 5128 | 68 | 2026-02-24 | NULL | completed | 12.9 |
| 5129 | 81 | 2026-02-25 | 9 | completed | 29.9 |
| 5130 | 52 | 2026-02-28 | NULL | completed | 59.9 |
| 5131 | 38 | 2026-03-01 | 3 | completed | 89.9 |
| 5132 | 82 | 2026-03-01 | NULL | completed | 19.9 |
| 5133 | 4 | 2026-03-02 | NULL | completed | 29.8 |
| 5134 | 67 | 2026-03-03 | 11 | completed | 39.9 |
| 5135 | 2 | 2026-03-05 | 9 | completed | 44.9 |
| 5136 | 17 | 2026-03-05 | NULL | completed | 79.9 |
| 5137 | 31 | 2026-03-06 | NULL | completed | 136.7 |
| 5138 | 83 | 2026-03-07 | NULL | completed | 49.9 |
| 5139 | 70 | 2026-03-08 | 11 | completed | 47.8 |
| 5140 | 84 | 2026-03-11 | 3 | completed | 49.8 |
| 5141 | 7 | 2026-03-12 | NULL | completed | 19.9 |
| 5142 | 53 | 2026-03-12 | 11 | completed | 19.9 |
| 5143 | 85 | 2026-03-12 | 4 | completed | 22.8 |
| 5144 | 5 | 2026-03-13 | NULL | cancelled | 104.8 |
| 5145 | 16 | 2026-03-14 | 9 | completed | 34.9 |
| 5146 | 57 | 2026-03-15 | NULL | completed | 107.8 |
| 5147 | 14 | 2026-03-16 | 11 | completed | 24.9 |
| 5148 | 32 | 2026-03-16 | 11 | completed | 34.9 |
| 5149 | 54 | 2026-03-17 | NULL | completed | 34.9 |
| 5150 | 86 | 2026-03-17 | NULL | completed | 25.8 |
| 5151 | 27 | 2026-03-18 | NULL | completed | 9.9 |
| 5152 | 87 | 2026-03-19 | 9 | completed | 119 |
| 5153 | 72 | 2026-03-22 | 11 | completed | 24.9 |
| 5154 | 88 | 2026-04-01 | 4 | completed | 29.9 |
| 5155 | 89 | 2026-04-05 | 9 | completed | 49.9 |
| 5156 | 90 | 2026-04-05 | 9 | completed | 102.8 |
| 5157 | 74 | 2026-04-06 | 3 | completed | 24.9 |
| 5158 | 91 | 2026-04-11 | 9 | completed | 29.9 |
| 5159 | 61 | 2026-04-12 | NULL | completed | 79.9 |
| 5160 | 92 | 2026-04-14 | NULL | completed | 29.9 |
| 5161 | 93 | 2026-04-19 | NULL | completed | 29.9 |
| 5162 | 94 | 2026-04-24 | 9 | completed | 29.9 |
| 5163 | 95 | 2026-04-28 | 4 | completed | 44.9 |
| 5164 | 96 | 2026-04-30 | 9 | completed | 129 |
| 5165 | 92 | 2026-05-07 | NULL | completed | 55.7 |
| 5166 | 97 | 2026-05-10 | 4 | completed | 54.8 |
| 5167 | 98 | 2026-05-11 | 9 | completed | 14.9 |
| 5168 | 99 | 2026-05-13 | 4 | completed | 34.9 |
| 5169 | 100 | 2026-05-18 | 9 | completed | 129 |
| 5170 | 101 | 2026-05-19 | 4 | completed | 148.7 |
| 5171 | 63 | 2026-05-23 | 3 | cancelled | 24.9 |
| 5172 | 102 | 2026-05-25 | NULL | completed | 44.9 |
| 5173 | 78 | 2026-06-01 | NULL | cancelled | 153.9 |
| 5174 | 103 | 2026-06-01 | NULL | completed | 99.9 |
| 5175 | 42 | 2026-06-02 | 9 | completed | 129 |
| 5176 | 104 | 2026-06-04 | NULL | completed | 49.9 |
| 5177 | 105 | 2026-06-08 | NULL | completed | 19.9 |
| 5178 | 50 | 2026-06-09 | NULL | completed | 102.8 |
| 5179 | 106 | 2026-06-09 | NULL | completed | 119.7 |
| 5180 | 107 | 2026-06-16 | 4 | cancelled | 29.7 |
| 5181 | 108 | 2026-06-22 | 9 | completed | 12.9 |
| 5182 | 79 | 2026-06-23 | 3 | completed | 99.9 |
| 5183 | 109 | 2026-06-26 | 4 | completed | 129 |
| 5184 | 110 | 2026-06-26 | NULL | cancelled | 24.9 |
| 5185 | 81 | 2026-06-28 | NULL | completed | 99.9 |
| 5186 | 111 | 2026-07-02 | NULL | completed | 158.9 |
| 5187 | 77 | 2026-07-04 | NULL | completed | 114.7 |
| 5188 | 112 | 2026-07-04 | NULL | completed | 39.9 |
| 5189 | 113 | 2026-07-09 | 4 | cancelled | 19.9 |
| 5190 | 114 | 2026-07-14 | NULL | completed | 49.9 |
| 5191 | 83 | 2026-07-15 | NULL | completed | 148.7 |
| 5192 | 76 | 2026-07-17 | NULL | completed | 34.9 |
| 5193 | 84 | 2026-07-17 | NULL | completed | 34.9 |
| 5194 | 115 | 2026-07-19 | NULL | completed | 79.9 |
| 5195 | 74 | 2026-07-23 | 3 | completed | 33.8 |
| 5196 | 92 | 2026-07-27 | 12 | completed | 19.9 |
| 5197 | 116 | 2026-07-27 | 12 | completed | 27.9 |
| 5198 | 117 | 2026-07-28 | NULL | completed | 99.9 |
| 5199 | 67 | 2026-07-30 | 3 | completed | 29.9 |
| 5200 | 118 | 2026-08-03 | NULL | completed | 119 |
| 5201 | 119 | 2026-08-07 | 3 | completed | 102.8 |
| 5202 | 120 | 2026-08-09 | NULL | completed | 89.9 |
| 5203 | 93 | 2026-08-15 | 3 | completed | 47.8 |
| 5204 | 121 | 2026-08-15 | NULL | completed | 27.9 |
| 5205 | 122 | 2026-08-18 | NULL | completed | 44.9 |
| 5206 | 102 | 2026-08-24 | 3 | completed | 89.8 |
| 5207 | 123 | 2026-08-25 | 12 | completed | 142.7 |
| 5208 | 124 | 2026-08-27 | 12 | completed | 113.7 |
| 5209 | 95 | 2026-08-28 | 12 | completed | 99.9 |
| 5210 | 92 | 2026-08-31 | 3 | completed | 29.8 |
| 5211 | 125 | 2026-08-31 | 3 | completed | 19.9 |
| 5212 | 110 | 2026-09-01 | NULL | completed | 42.7 |
| 5213 | 126 | 2026-09-03 | 3 | completed | 29.9 |
| 5214 | 127 | 2026-09-07 | NULL | completed | 29.8 |
| 5215 | 128 | 2026-09-13 | NULL | completed | 24.9 |
| 5216 | 129 | 2026-09-19 | 13 | completed | 89.9 |
| 5217 | 130 | 2026-09-20 | NULL | completed | 19.9 |
| 5218 | 117 | 2026-09-21 | 3 | completed | 96.8 |
| 5219 | 131 | 2026-09-22 | 3 | completed | 89.9 |
| 5220 | 50 | 2026-09-23 | NULL | completed | 44.9 |
| 5221 | 91 | 2026-09-23 | NULL | completed | 89.9 |
| 5222 | 92 | 2026-09-23 | 3 | completed | 89.9 |
| 5223 | 132 | 2026-09-26 | 12 | completed | 89.9 |
| 5224 | 115 | 2026-10-03 | NULL | completed | 25.8 |
| 5225 | 133 | 2026-10-04 | 13 | cancelled | 49.9 |
| 5226 | 63 | 2026-10-05 | NULL | completed | 24.9 |
| 5227 | 134 | 2026-10-05 | 13 | completed | 27.9 |
| 5228 | 106 | 2026-10-08 | NULL | completed | 29.9 |
| 5229 | 119 | 2026-10-08 | NULL | completed | 24.9 |
| 5230 | 135 | 2026-10-10 | 12 | completed | 24.9 |
| 5231 | 95 | 2026-10-13 | NULL | completed | 24.9 |
| 5232 | 102 | 2026-10-13 | NULL | completed | 49.9 |
| 5233 | 98 | 2026-10-14 | NULL | completed | 14.9 |
| 5234 | 136 | 2026-10-16 | 4 | completed | 24.9 |
| 5235 | 137 | 2026-10-20 | 3 | completed | 34.9 |
| 5236 | 138 | 2026-10-22 | 13 | completed | 34.9 |
| 5237 | 139 | 2026-10-27 | NULL | completed | 89.8 |
| 5238 | 140 | 2026-10-29 | 3 | completed | 19.9 |
| 5239 | 112 | 2026-10-31 | NULL | completed | 104.8 |
campaigns 14 rows, 6 columns
| campaign_id | name | channel | start_date | end_date | cost |
|---|---|---|---|---|---|
| 1 | Paid search H1 2025 | Paid Search | 2025-01-01 | 2025-06-30 | 120 |
| 2 | Paid social spring 2025 | Paid Social | 2025-03-01 | 2025-05-31 | 160 |
| 3 | Email newsletter (ongoing) | 2025-01-01 | 2026-12-31 | 360 | |
| 4 | Affiliate program sports blogs | Affiliate | 2025-01-01 | 2026-12-31 | 240 |
| 5 | Paid search H2 2025 | Paid Search | 2025-07-01 | 2025-12-31 | 420 |
| 6 | Paid social summer 2025 | Paid Social | 2025-06-15 | 2025-08-31 | 180 |
| 7 | Email Black Friday week 2025 | 2025-11-24 | 2025-12-01 | 40 | |
| 8 | Paid social Black Friday week 2025 | Paid Social | 2025-11-20 | 2025-12-01 | 230 |
| 9 | Paid search H1 2026 | Paid Search | 2026-01-01 | 2026-06-30 | 450 |
| 10 | Paid social fitness January 2026 | Paid Social | 2026-01-02 | 2026-01-31 | 150 |
| 11 | Email spring sale 2026 | 2026-03-02 | 2026-03-31 | 40 | |
| 12 | Paid search H2 2026 | Paid Search | 2026-07-01 | 2026-12-31 | 380 |
| 13 | Paid social Sep/Oct 2026 | Paid Social | 2026-09-15 | 2026-10-31 | 220 |
| 14 | Paid social video test | Paid Social | 2026-05-04 | 2026-05-24 | 120 |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
17. Finding short payment terms
Task Accounts is checking special terms. Show every invoice whose payment term is shorter than 30 days (days from invoice_date to due_date): invoice_id, customer and term_days (as a whole number), sorted by invoice_id.
invoices 60 rows, 5 columns
| invoice_id | customer | invoice_date | due_date | amount |
|---|---|---|---|---|
| 26001 | Northgate Cycles Ltd | 2026-01-03 | 2026-02-02 | 26959.83 |
| 26002 | Riverside Bike Co. | 2026-01-06 | 2026-02-05 | 14721.94 |
| 26003 | Hillcrest Cycle Shop | 2026-01-08 | 2026-02-07 | 16992.65 |
| 26004 | Pedal Point Inc. | 2026-01-12 | 2026-02-11 | 23417.22 |
| 26005 | Urban Wheels Online | 2026-01-15 | 2026-03-16 | 28124.62 |
| 26006 | Summit Outdoor Supply | 2026-01-17 | 2026-02-16 | 20273.54 |
| 26007 | Coastline Cycles | 2026-01-21 | 2026-02-20 | 12687.37 |
| 26008 | Greenway Bikes | 2026-01-23 | 2026-02-22 | 11730.56 |
| 26009 | Two Wheel Depot | 2026-01-26 | 2026-02-25 | 19622.5 |
| 26010 | Maple Street Cycles | 2026-01-29 | 2026-02-12 | 15772.49 |
| 26011 | Northgate Cycles Ltd | 2026-02-03 | 2026-03-05 | 34472.71 |
| 26012 | Riverside Bike Co. | 2026-02-05 | 2026-03-07 | 21466.08 |
| 26013 | Hillcrest Cycle Shop | 2026-02-09 | 2026-03-11 | 20975.08 |
| 26014 | Pedal Point Inc. | 2026-02-12 | 2026-03-14 | 30082.56 |
| 26015 | Urban Wheels Online | 2026-02-14 | 2026-04-15 | 40785.91 |
| 26016 | Summit Outdoor Supply | 2026-02-18 | 2026-03-20 | 24787.09 |
| 26017 | Coastline Cycles | 2026-02-21 | 2026-03-23 | 16231.53 |
| 26018 | Greenway Bikes | 2026-02-24 | 2026-03-26 | 14692.65 |
| 26019 | Two Wheel Depot | 2026-02-26 | 2026-03-28 | 26205.7 |
| 26020 | Maple Street Cycles | 2026-02-26 | 2026-03-12 | 19640.44 |
| 26021 | Northgate Cycles Ltd | 2026-03-03 | 2026-04-02 | 54429.19 |
| 26022 | Riverside Bike Co. | 2026-03-06 | 2026-04-05 | 32466.62 |
| 26023 | Hillcrest Cycle Shop | 2026-03-08 | 2026-04-07 | 34701.33 |
| 26024 | Pedal Point Inc. | 2026-03-11 | 2026-04-10 | 52082.83 |
| 26025 | Urban Wheels Online | 2026-03-14 | 2026-05-13 | 59991.26 |
| 26026 | Summit Outdoor Supply | 2026-03-17 | 2026-04-16 | 37796.33 |
| 26027 | Coastline Cycles | 2026-03-20 | 2026-04-19 | 24397.37 |
| 26028 | Greenway Bikes | 2026-03-23 | 2026-04-22 | 21785.83 |
| 26029 | Two Wheel Depot | 2026-03-27 | 2026-04-26 | 39812.27 |
| 26030 | Maple Street Cycles | 2026-03-29 | 2026-04-12 | 18452.9 |
| 26031 | Northgate Cycles Ltd | 2026-04-02 | 2026-05-02 | 59320 |
| 26032 | Riverside Bike Co. | 2026-04-06 | 2026-05-06 | 37402.19 |
| 26033 | Hillcrest Cycle Shop | 2026-04-08 | 2026-05-08 | 42329.35 |
| 26034 | Pedal Point Inc. | 2026-04-11 | 2026-05-11 | 61184.01 |
| 26035 | Urban Wheels Online | 2026-04-14 | 2026-06-13 | 75122.1 |
| 26036 | Summit Outdoor Supply | 2026-04-18 | 2026-05-18 | 42952.05 |
| 26037 | Coastline Cycles | 2026-04-20 | 2026-05-20 | 29968.46 |
| 26038 | Greenway Bikes | 2026-04-24 | 2026-05-24 | 25966.97 |
| 26039 | Two Wheel Depot | 2026-04-26 | 2026-05-26 | 50138.68 |
| 26040 | Maple Street Cycles | 2026-04-28 | 2026-05-12 | 27754.11 |
| 26041 | Northgate Cycles Ltd | 2026-05-03 | 2026-06-02 | 65530.8 |
| 26042 | Riverside Bike Co. | 2026-05-06 | 2026-06-05 | 37631.02 |
| 26043 | Hillcrest Cycle Shop | 2026-05-08 | 2026-06-07 | 41637.92 |
| 26044 | Pedal Point Inc. | 2026-05-11 | 2026-06-10 | 57840.47 |
| 26045 | Urban Wheels Online | 2026-05-14 | 2026-07-13 | 68239.27 |
| 26046 | Summit Outdoor Supply | 2026-05-17 | 2026-06-16 | 44576.3 |
| 26047 | Coastline Cycles | 2026-05-21 | 2026-06-20 | 28255.84 |
| 26048 | Greenway Bikes | 2026-05-24 | 2026-06-23 | 25800.16 |
| 26049 | Two Wheel Depot | 2026-05-26 | 2026-06-25 | 46653.8 |
| 26050 | Maple Street Cycles | 2026-05-29 | 2026-06-12 | 21711 |
| 26051 | Northgate Cycles Ltd | 2026-06-03 | 2026-07-03 | 48415.21 |
| 26052 | Riverside Bike Co. | 2026-06-06 | 2026-07-06 | 27191.07 |
| 26053 | Hillcrest Cycle Shop | 2026-06-09 | 2026-07-09 | 32156.21 |
| 26054 | Pedal Point Inc. | 2026-06-12 | 2026-07-12 | 46139.99 |
| 26055 | Urban Wheels Online | 2026-06-30 | 2026-08-29 | 55652 |
| 26056 | Summit Outdoor Supply | 2026-06-17 | 2026-07-17 | 37295.37 |
| 26057 | Coastline Cycles | 2026-06-20 | 2026-07-20 | 26031.62 |
| 26058 | Greenway Bikes | 2026-06-23 | 2026-07-23 | 21187.55 |
| 26059 | Two Wheel Depot | 2026-06-27 | 2026-07-27 | 41200.86 |
| 26060 | Maple Street Cycles | 2026-06-28 | 2026-07-12 | 14292.64 |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
What these questions have in common
- Check the grain first: what is one row of the table, an order or an order line? That decides whether COUNT(*) or COUNT(DISTINCT ...) is right.
- Think about NULL: a condition with <> or = loses rows with NULL, and COUNT(column) skips them. Interviewers notice when you bring this up yourself.
- Dates as text: SQLite stores dates as YYYY-MM-DD text. Comparing works directly, calculating only with date() or julianday().
- Percentages need a decimal: 100.0 instead of 100, or the database cuts off the decimals.
FAQ
What do I need to know for the basic questions?
SELECT with WHERE, ORDER BY, GROUP BY with HAVING, CASE, the main text and date functions and a simple JOIN. That's levels 1 to 3 of the SQL course.
Why doesn't my query count even though the result looks the same?
Usually because of the variant: the check runs a second time on changed data. If a value is typed into the query or a condition is missing that happens not to matter for the visible data, it shows up there. The message tells you what to look for.
Can I use different functions from the model answer?
Yes. The result is checked, not the text. NOT EXISTS instead of LEFT JOIN, BETWEEN instead of two comparisons: if the rows and values match, the question is solved.