Level 4 project: year-end data clean-up

At year end, the office supplies dealer tidies up its database: apply a new shipping rule, archive and delete the old year, find slow sellers. You write everything in SQL view.

You need: SQL view, action queries and subqueries.

The situation

Management has decided: from an order value of 100, shipping is free, backdated for all orders. The Orders table should also stay lean; everything from 2025 goes into an archive. And purchasing wants to know which products nobody has ordered since October.

Each part starts with fresh data. Together they count triple.

The project

Part 1: free shipping from 100

Task Part 1: From an order value of 100, shipping is free. Set Freight to 0 for every order whose lines add up (Quantity times SalePrice) to at least 100.

Orders 120 rows, 6 columns
OrderIDCustomerIDOrderDateShippedDateFreightPaymentMethod
11630 Apr 20253 May 20254.90Invoice
22318 May 202526 May 20254.90PayPal
31916 Jul 20264.90Direct debit
41131 Mar 20251 Apr 20250.00Invoice
567 Dec 20259 Dec 20259.90PayPal
61819 May 202626 May 20266.90Direct debit
7715 Jun 202616 Jun 20264.90Credit card
82018 Mar 202519 Mar 20250.00PayPal
91029 Oct 20253 Nov 20250.00Direct debit
10721 Nov 20264.90Invoice
1112 May 202510 May 20259.90Direct debit
12107 Aug 20259 Aug 20250.00Invoice
13317 Sep 202624 Sep 20269.90PayPal
141629 Jan 20261 Feb 20266.90Invoice
15413 Jun 202521 Jun 20254.90PayPal
16123 Nov 202512 Nov 20254.90Invoice
1795 May 20268 May 20269.90PayPal
18926 Sep 20252 Oct 20254.90PayPal
19148 Mar 202610 Mar 20260.00Credit card
2012 Apr 20266.90PayPal
211817 Nov 20264.90PayPal
221127 Jul 20264 Aug 20264.90PayPal
231223 Jun 202628 Jun 20264.90Credit card
241012 Jan 202616 Jan 20260.00Direct debit
25130 Mar 202631 Mar 20264.90Credit card
2633 Mar 20257 Mar 20254.90Invoice
27249 Mar 202511 Mar 20254.90PayPal
28122 Sep 202528 Sep 20254.90PayPal
29118 Feb 202522 Feb 20254.90Invoice
301913 Oct 202518 Oct 20254.90PayPal
311019 Sep 202525 Sep 20256.90PayPal
32619 Jun 202624 Jun 20264.90Credit card
332016 Jun 202622 Jun 20269.90Credit card
341323 May 202627 May 20269.90Direct debit
351624 May 20262 Jun 20264.90PayPal
36149 Nov 202614 Nov 20264.90PayPal
37311 Mar 202618 Mar 20269.90PayPal
38222 Jan 202510 Jan 20250.00Invoice
391221 Oct 202527 Oct 20250.00Invoice
40204 Nov 20265 Nov 20269.90PayPal
411729 Mar 202630 Mar 20264.90PayPal
42136 Jan 20268 Jan 20260.00Invoice
43324 Feb 202626 Feb 20264.90PayPal
44721 Sep 202628 Sep 20264.90Invoice
45217 Apr 202523 Apr 20250.00Direct debit
46727 Apr 202628 Apr 20264.90Invoice
47316 Nov 20266.90Direct debit
48126 Jun 202627 Jun 20264.90Credit card
492429 Apr 202630 Apr 20264.90PayPal
50123 Mar 202528 Mar 20254.90Direct debit
511028 Jan 202631 Jan 20260.00PayPal
52229 May 202615 May 20264.90Direct debit
531029 Dec 20257 Jan 20260.00Credit card
54417 Oct 202618 Oct 20269.90Credit card
552430 Aug 202531 Aug 20256.90Credit card
56629 Jan 20262 Feb 20264.90PayPal
571810 Dec 202513 Dec 20256.90Direct debit
58134 Mar 20259 Mar 20259.90Invoice
591129 Nov 20257 Dec 20256.90Invoice
60930 Oct 20254 Nov 20254.90Invoice
611017 Mar 202619 Mar 20264.90PayPal
62914 Jul 202521 Jul 20254.90PayPal
63824 May 20252 Jun 20250.00Invoice
64429 Sep 20265 Oct 20264.90Invoice
651022 Jan 202627 Jan 20269.90Invoice
66927 Mar 202628 Mar 20269.90Credit card
671411 Sep 202618 Sep 20264.90PayPal
6849 Jun 202616 Jun 20260.00Invoice
691710 Jan 202617 Jan 20269.90Credit card
70211 Apr 20262 Apr 20264.90Credit card
711519 Mar 202521 Mar 20254.90Credit card
72204 Mar 20256 Mar 20254.90Invoice
731024 May 20259.90PayPal
7483 Jan 20254 Jan 20259.90Invoice
752330 Oct 20256 Nov 20259.90Direct debit
762230 Aug 20253 Sep 20256.90Invoice
77218 Nov 202523 Nov 20256.90PayPal
78322 Dec 202526 Dec 20254.90Invoice
792126 May 20266.90Invoice
802423 Feb 202627 Feb 20264.90Direct debit
8125 Jun 20266.90PayPal
821114 Aug 20266.90Invoice
832110 May 202618 May 20269.90Credit card
841312 Feb 202519 Feb 20254.90Credit card
85222 Jan 202630 Jan 20264.90PayPal
86231 Oct 20254 Nov 20259.90Credit card
8769 Mar 202517 Mar 20259.90Credit card
8835 Feb 202514 Feb 20259.90Direct debit
891726 Jan 202529 Jan 20256.90PayPal
901125 Sep 20264.90Direct debit
912223 May 20251 Jun 20254.90Credit card
922029 Jan 20252 Feb 20250.00PayPal
93816 Jul 202618 Jul 20266.90Invoice
9427 Aug 202510 Aug 20250.00Invoice
95226 Jan 20258 Jan 20256.90Credit card
961515 Dec 202524 Dec 20254.90Invoice
97623 Sep 202530 Sep 20256.90Invoice
981010 Sep 202516 Sep 20250.00Invoice
991410 Jan 202613 Jan 20269.90Credit card
1001620 Nov 202524 Nov 20250.00Credit card
1011826 Jul 202627 Jul 20264.90Credit card
102215 May 20259.90Invoice
10348 Feb 202515 Feb 20256.90Credit card
104716 Sep 202617 Sep 20264.90Invoice
105726 Jan 202531 Jan 20254.90Direct debit
106232 Aug 20263 Aug 20266.90Direct debit
1071322 Jan 202626 Jan 20269.90Credit card
10846 Oct 202514 Oct 20254.90Direct debit
109106 Nov 20259 Nov 20254.90Direct debit
110917 Oct 202618 Oct 20269.90PayPal
1112324 May 202625 May 20266.90Direct debit
112231 Aug 20251 Sep 20259.90Direct debit
1132025 Jul 202628 Jul 20260.00Direct debit
114624 Nov 202527 Nov 20259.90Credit card
115827 Nov 202530 Nov 20256.90Credit card
116118 Mar 202525 Mar 20250.00Direct debit
117916 Mar 202519 Mar 20256.90Credit card
118410 Jul 202615 Jul 20260.00Invoice
1191423 Jun 202528 Jun 20254.90Direct debit
120221 Sep 202627 Sep 20264.90Direct debit
OrderDetails 321 rows, 5 columns
DetailIDOrderIDProductIDQuantitySalePrice
11121.20
221757.50
32122349.00
428334.90
53328.50
64689.90
74348.50
847719.90
9410149.00
105181.20
1154212.90
1251444.50
135121349.00
1461424.50
156131129.00
1677219.90
1778734.90
188572.80
199582.80
209328.50
21108134.90
2210233.90
2310191.20
24111511.90
2511263.90
2611132129.00
271110149.00
2812111189.00
2913131129.00
30131616.90
3114132129.00
3214542.80
33144312.90
34156109.90
35164712.90
36161444.50
37163108.50
381691229.00
39177619.90
40181541.90
41187119.90
421992229.00
4319131129.00
44204612.90
4520582.80
4620122349.00
472017107.50
48218834.90
4921562.80
50217419.90
51211571.90
5222388.50
532392229.00
5423213.90
552491229.00
5624669.90
5724233.90
58244612.90
59257619.90
60251474.50
612515101.90
6226552.80
632617107.50
642692229.00
65271474.50
66274912.90
6728689.90
68287919.90
69291444.50
70297619.90
7130552.80
723110149.00
73311747.50
743192229.00
75321484.50
7632111189.00
773292229.00
78331737.50
7933121349.00
8034111.20
81351531.90
82358934.90
8336233.90
84361561.90
85368134.90
86367519.90
8737253.90
883791229.00
89381727.50
9038131129.00
9138619.90
9239131.20
933910149.00
94401454.50
954110149.00
96411571.90
9741112189.00
98411727.50
9942213.90
100433108.50
1014317107.50
102431484.50
1034410249.00
104448534.90
105451686.90
10645328.50
107455102.80
10846512.80
109467519.90
110461797.50
11147572.80
11247121349.00
1134710249.00
114473108.50
11548132129.00
116488134.90
11748121349.00
1184841012.90
119498434.90
120491541.90
12149293.90
12249141.20
123501444.50
124504112.90
12550131129.00
12651619.90
12751243.90
12851121349.00
129517719.90
130521727.50
131528134.90
13252358.50
133522103.90
13453132129.00
13553348.50
13653582.80
13754111189.00
138541797.50
13954293.90
1405410249.00
141558934.90
14256679.90
14356112189.00
144571616.90
145574412.90
14657112189.00
14757131129.00
148581656.90
149591571.90
15059111189.00
151594612.90
152608834.90
153601521.90
154611727.50
15561293.90
15661582.80
157624312.90
158621767.50
15963112189.00
160631521.90
161647219.90
162654512.90
16365572.80
164651777.50
1656692229.00
16666121349.00
1676615101.90
16867132129.00
1696792229.00
170674112.90
171681444.50
172681747.50
17368619.90
174698134.90
175707319.90
176701797.50
177701676.90
17870348.50
179711581.90
180717319.90
1817191229.00
18272121349.00
183721434.50
18472131129.00
18572542.80
18673273.90
18773122349.00
188731424.50
1897410249.00
190741484.50
19175112189.00
1927515101.90
19375132129.00
194764812.90
195761676.90
196778634.90
19777121349.00
198781494.50
19978542.80
200781636.90
201795102.80
2028010249.00
203807419.90
20480112189.00
20581122349.00
2068181034.90
2078210249.00
208821551.90
20982318.50
21082649.90
211831474.50
212831551.90
21384689.90
214848134.90
2158491229.00
21684112189.00
217851797.50
21885111189.00
21985121349.00
22085131129.00
221861511.90
22286582.80
223867219.90
22487233.90
225877119.90
22687111189.00
227874512.90
228888734.90
229881511.90
23088629.90
231897619.90
23290122349.00
233901656.90
23490131.20
2359015101.90
236911561.90
2379181034.90
238927619.90
2399216106.90
24093669.90
24193131129.00
242934912.90
24394522.80
24495328.50
2459610249.00
24697112189.00
24797669.90
24897358.50
24998111189.00
25098181.20
2519810149.00
25298659.90
253991646.90
254997519.90
255994412.90
256991777.50
2571007219.90
2581008134.90
2591001727.50
260100669.90
261101388.50
262101121349.00
263101243.90
264102121349.00
265102132129.00
2661027719.90
267102398.50
268103512.80
2691041494.50
270104112189.00
2711041521.90
2721047219.90
273105132129.00
2741058734.90
2751054812.90
2761051676.90
2771067319.90
278107233.90
27910881034.90
2801081531.90
2811087419.90
282108111189.00
283109131.20
2841094212.90
2851091511.90
2861092103.90
2871101666.90
2881104912.90
289110368.50
29011091229.00
291111121349.00
2921111531.90
2931111727.50
294112121349.00
29511210249.00
296112223.90
2971131717.50
29811315101.90
29911392229.00
3001134912.90
3011143108.50
302114532.80
303114273.90
3041148234.90
3051151727.50
3061153108.50
307116659.90
30811691229.00
3091171636.90
3101178934.90
311117171.20
3121171757.50
3131181464.50
314118659.90
315118112189.00
316119639.90
3171191777.50
318119131129.00
3191201777.50
320120542.80
3211204512.90

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

Part 2: create the archive

Task Part 2: Before cleaning up, the data is archived. Create the table Archive2025 with every field of all orders from 2025.

Orders 120 rows, 6 columns
OrderIDCustomerIDOrderDateShippedDateFreightPaymentMethod
11630 Apr 20253 May 20254.90Invoice
22318 May 202526 May 20254.90PayPal
31916 Jul 20264.90Direct debit
41131 Mar 20251 Apr 20250.00Invoice
567 Dec 20259 Dec 20259.90PayPal
61819 May 202626 May 20266.90Direct debit
7715 Jun 202616 Jun 20264.90Credit card
82018 Mar 202519 Mar 20250.00PayPal
91029 Oct 20253 Nov 20250.00Direct debit
10721 Nov 20264.90Invoice
1112 May 202510 May 20259.90Direct debit
12107 Aug 20259 Aug 20250.00Invoice
13317 Sep 202624 Sep 20269.90PayPal
141629 Jan 20261 Feb 20266.90Invoice
15413 Jun 202521 Jun 20254.90PayPal
16123 Nov 202512 Nov 20254.90Invoice
1795 May 20268 May 20269.90PayPal
18926 Sep 20252 Oct 20254.90PayPal
19148 Mar 202610 Mar 20260.00Credit card
2012 Apr 20266.90PayPal
211817 Nov 20264.90PayPal
221127 Jul 20264 Aug 20264.90PayPal
231223 Jun 202628 Jun 20264.90Credit card
241012 Jan 202616 Jan 20260.00Direct debit
25130 Mar 202631 Mar 20264.90Credit card
2633 Mar 20257 Mar 20254.90Invoice
27249 Mar 202511 Mar 20254.90PayPal
28122 Sep 202528 Sep 20254.90PayPal
29118 Feb 202522 Feb 20254.90Invoice
301913 Oct 202518 Oct 20254.90PayPal
311019 Sep 202525 Sep 20256.90PayPal
32619 Jun 202624 Jun 20264.90Credit card
332016 Jun 202622 Jun 20269.90Credit card
341323 May 202627 May 20269.90Direct debit
351624 May 20262 Jun 20264.90PayPal
36149 Nov 202614 Nov 20264.90PayPal
37311 Mar 202618 Mar 20269.90PayPal
38222 Jan 202510 Jan 20250.00Invoice
391221 Oct 202527 Oct 20250.00Invoice
40204 Nov 20265 Nov 20269.90PayPal
411729 Mar 202630 Mar 20264.90PayPal
42136 Jan 20268 Jan 20260.00Invoice
43324 Feb 202626 Feb 20264.90PayPal
44721 Sep 202628 Sep 20264.90Invoice
45217 Apr 202523 Apr 20250.00Direct debit
46727 Apr 202628 Apr 20264.90Invoice
47316 Nov 20266.90Direct debit
48126 Jun 202627 Jun 20264.90Credit card
492429 Apr 202630 Apr 20264.90PayPal
50123 Mar 202528 Mar 20254.90Direct debit
511028 Jan 202631 Jan 20260.00PayPal
52229 May 202615 May 20264.90Direct debit
531029 Dec 20257 Jan 20260.00Credit card
54417 Oct 202618 Oct 20269.90Credit card
552430 Aug 202531 Aug 20256.90Credit card
56629 Jan 20262 Feb 20264.90PayPal
571810 Dec 202513 Dec 20256.90Direct debit
58134 Mar 20259 Mar 20259.90Invoice
591129 Nov 20257 Dec 20256.90Invoice
60930 Oct 20254 Nov 20254.90Invoice
611017 Mar 202619 Mar 20264.90PayPal
62914 Jul 202521 Jul 20254.90PayPal
63824 May 20252 Jun 20250.00Invoice
64429 Sep 20265 Oct 20264.90Invoice
651022 Jan 202627 Jan 20269.90Invoice
66927 Mar 202628 Mar 20269.90Credit card
671411 Sep 202618 Sep 20264.90PayPal
6849 Jun 202616 Jun 20260.00Invoice
691710 Jan 202617 Jan 20269.90Credit card
70211 Apr 20262 Apr 20264.90Credit card
711519 Mar 202521 Mar 20254.90Credit card
72204 Mar 20256 Mar 20254.90Invoice
731024 May 20259.90PayPal
7483 Jan 20254 Jan 20259.90Invoice
752330 Oct 20256 Nov 20259.90Direct debit
762230 Aug 20253 Sep 20256.90Invoice
77218 Nov 202523 Nov 20256.90PayPal
78322 Dec 202526 Dec 20254.90Invoice
792126 May 20266.90Invoice
802423 Feb 202627 Feb 20264.90Direct debit
8125 Jun 20266.90PayPal
821114 Aug 20266.90Invoice
832110 May 202618 May 20269.90Credit card
841312 Feb 202519 Feb 20254.90Credit card
85222 Jan 202630 Jan 20264.90PayPal
86231 Oct 20254 Nov 20259.90Credit card
8769 Mar 202517 Mar 20259.90Credit card
8835 Feb 202514 Feb 20259.90Direct debit
891726 Jan 202529 Jan 20256.90PayPal
901125 Sep 20264.90Direct debit
912223 May 20251 Jun 20254.90Credit card
922029 Jan 20252 Feb 20250.00PayPal
93816 Jul 202618 Jul 20266.90Invoice
9427 Aug 202510 Aug 20250.00Invoice
95226 Jan 20258 Jan 20256.90Credit card
961515 Dec 202524 Dec 20254.90Invoice
97623 Sep 202530 Sep 20256.90Invoice
981010 Sep 202516 Sep 20250.00Invoice
991410 Jan 202613 Jan 20269.90Credit card
1001620 Nov 202524 Nov 20250.00Credit card
1011826 Jul 202627 Jul 20264.90Credit card
102215 May 20259.90Invoice
10348 Feb 202515 Feb 20256.90Credit card
104716 Sep 202617 Sep 20264.90Invoice
105726 Jan 202531 Jan 20254.90Direct debit
106232 Aug 20263 Aug 20266.90Direct debit
1071322 Jan 202626 Jan 20269.90Credit card
10846 Oct 202514 Oct 20254.90Direct debit
109106 Nov 20259 Nov 20254.90Direct debit
110917 Oct 202618 Oct 20269.90PayPal
1112324 May 202625 May 20266.90Direct debit
112231 Aug 20251 Sep 20259.90Direct debit
1132025 Jul 202628 Jul 20260.00Direct debit
114624 Nov 202527 Nov 20259.90Credit card
115827 Nov 202530 Nov 20256.90Credit card
116118 Mar 202525 Mar 20250.00Direct debit
117916 Mar 202519 Mar 20256.90Credit card
118410 Jul 202615 Jul 20260.00Invoice
1191423 Jun 202528 Jun 20254.90Direct debit
120221 Sep 202627 Sep 20264.90Direct debit

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

Part 3: delete the old year

Task Part 3: The archived orders from 2025 are deleted; their lines go along through cascade delete.

Orders 120 rows, 6 columns
OrderIDCustomerIDOrderDateShippedDateFreightPaymentMethod
11630 Apr 20253 May 20254.90Invoice
22318 May 202526 May 20254.90PayPal
31916 Jul 20264.90Direct debit
41131 Mar 20251 Apr 20250.00Invoice
567 Dec 20259 Dec 20259.90PayPal
61819 May 202626 May 20266.90Direct debit
7715 Jun 202616 Jun 20264.90Credit card
82018 Mar 202519 Mar 20250.00PayPal
91029 Oct 20253 Nov 20250.00Direct debit
10721 Nov 20264.90Invoice
1112 May 202510 May 20259.90Direct debit
12107 Aug 20259 Aug 20250.00Invoice
13317 Sep 202624 Sep 20269.90PayPal
141629 Jan 20261 Feb 20266.90Invoice
15413 Jun 202521 Jun 20254.90PayPal
16123 Nov 202512 Nov 20254.90Invoice
1795 May 20268 May 20269.90PayPal
18926 Sep 20252 Oct 20254.90PayPal
19148 Mar 202610 Mar 20260.00Credit card
2012 Apr 20266.90PayPal
211817 Nov 20264.90PayPal
221127 Jul 20264 Aug 20264.90PayPal
231223 Jun 202628 Jun 20264.90Credit card
241012 Jan 202616 Jan 20260.00Direct debit
25130 Mar 202631 Mar 20264.90Credit card
2633 Mar 20257 Mar 20254.90Invoice
27249 Mar 202511 Mar 20254.90PayPal
28122 Sep 202528 Sep 20254.90PayPal
29118 Feb 202522 Feb 20254.90Invoice
301913 Oct 202518 Oct 20254.90PayPal
311019 Sep 202525 Sep 20256.90PayPal
32619 Jun 202624 Jun 20264.90Credit card
332016 Jun 202622 Jun 20269.90Credit card
341323 May 202627 May 20269.90Direct debit
351624 May 20262 Jun 20264.90PayPal
36149 Nov 202614 Nov 20264.90PayPal
37311 Mar 202618 Mar 20269.90PayPal
38222 Jan 202510 Jan 20250.00Invoice
391221 Oct 202527 Oct 20250.00Invoice
40204 Nov 20265 Nov 20269.90PayPal
411729 Mar 202630 Mar 20264.90PayPal
42136 Jan 20268 Jan 20260.00Invoice
43324 Feb 202626 Feb 20264.90PayPal
44721 Sep 202628 Sep 20264.90Invoice
45217 Apr 202523 Apr 20250.00Direct debit
46727 Apr 202628 Apr 20264.90Invoice
47316 Nov 20266.90Direct debit
48126 Jun 202627 Jun 20264.90Credit card
492429 Apr 202630 Apr 20264.90PayPal
50123 Mar 202528 Mar 20254.90Direct debit
511028 Jan 202631 Jan 20260.00PayPal
52229 May 202615 May 20264.90Direct debit
531029 Dec 20257 Jan 20260.00Credit card
54417 Oct 202618 Oct 20269.90Credit card
552430 Aug 202531 Aug 20256.90Credit card
56629 Jan 20262 Feb 20264.90PayPal
571810 Dec 202513 Dec 20256.90Direct debit
58134 Mar 20259 Mar 20259.90Invoice
591129 Nov 20257 Dec 20256.90Invoice
60930 Oct 20254 Nov 20254.90Invoice
611017 Mar 202619 Mar 20264.90PayPal
62914 Jul 202521 Jul 20254.90PayPal
63824 May 20252 Jun 20250.00Invoice
64429 Sep 20265 Oct 20264.90Invoice
651022 Jan 202627 Jan 20269.90Invoice
66927 Mar 202628 Mar 20269.90Credit card
671411 Sep 202618 Sep 20264.90PayPal
6849 Jun 202616 Jun 20260.00Invoice
691710 Jan 202617 Jan 20269.90Credit card
70211 Apr 20262 Apr 20264.90Credit card
711519 Mar 202521 Mar 20254.90Credit card
72204 Mar 20256 Mar 20254.90Invoice
731024 May 20259.90PayPal
7483 Jan 20254 Jan 20259.90Invoice
752330 Oct 20256 Nov 20259.90Direct debit
762230 Aug 20253 Sep 20256.90Invoice
77218 Nov 202523 Nov 20256.90PayPal
78322 Dec 202526 Dec 20254.90Invoice
792126 May 20266.90Invoice
802423 Feb 202627 Feb 20264.90Direct debit
8125 Jun 20266.90PayPal
821114 Aug 20266.90Invoice
832110 May 202618 May 20269.90Credit card
841312 Feb 202519 Feb 20254.90Credit card
85222 Jan 202630 Jan 20264.90PayPal
86231 Oct 20254 Nov 20259.90Credit card
8769 Mar 202517 Mar 20259.90Credit card
8835 Feb 202514 Feb 20259.90Direct debit
891726 Jan 202529 Jan 20256.90PayPal
901125 Sep 20264.90Direct debit
912223 May 20251 Jun 20254.90Credit card
922029 Jan 20252 Feb 20250.00PayPal
93816 Jul 202618 Jul 20266.90Invoice
9427 Aug 202510 Aug 20250.00Invoice
95226 Jan 20258 Jan 20256.90Credit card
961515 Dec 202524 Dec 20254.90Invoice
97623 Sep 202530 Sep 20256.90Invoice
981010 Sep 202516 Sep 20250.00Invoice
991410 Jan 202613 Jan 20269.90Credit card
1001620 Nov 202524 Nov 20250.00Credit card
1011826 Jul 202627 Jul 20264.90Credit card
102215 May 20259.90Invoice
10348 Feb 202515 Feb 20256.90Credit card
104716 Sep 202617 Sep 20264.90Invoice
105726 Jan 202531 Jan 20254.90Direct debit
106232 Aug 20263 Aug 20266.90Direct debit
1071322 Jan 202626 Jan 20269.90Credit card
10846 Oct 202514 Oct 20254.90Direct debit
109106 Nov 20259 Nov 20254.90Direct debit
110917 Oct 202618 Oct 20269.90PayPal
1112324 May 202625 May 20266.90Direct debit
112231 Aug 20251 Sep 20259.90Direct debit
1132025 Jul 202628 Jul 20260.00Direct debit
114624 Nov 202527 Nov 20259.90Credit card
115827 Nov 202530 Nov 20256.90Credit card
116118 Mar 202525 Mar 20250.00Direct debit
117916 Mar 202519 Mar 20256.90Credit card
118410 Jul 202615 Jul 20260.00Invoice
1191423 Jun 202528 Jun 20254.90Direct debit
120221 Sep 202627 Sep 20264.90Direct debit
OrderDetails 321 rows, 5 columns
DetailIDOrderIDProductIDQuantitySalePrice
11121.20
221757.50
32122349.00
428334.90
53328.50
64689.90
74348.50
847719.90
9410149.00
105181.20
1154212.90
1251444.50
135121349.00
1461424.50
156131129.00
1677219.90
1778734.90
188572.80
199582.80
209328.50
21108134.90
2210233.90
2310191.20
24111511.90
2511263.90
2611132129.00
271110149.00
2812111189.00
2913131129.00
30131616.90
3114132129.00
3214542.80
33144312.90
34156109.90
35164712.90
36161444.50
37163108.50
381691229.00
39177619.90
40181541.90
41187119.90
421992229.00
4319131129.00
44204612.90
4520582.80
4620122349.00
472017107.50
48218834.90
4921562.80
50217419.90
51211571.90
5222388.50
532392229.00
5423213.90
552491229.00
5624669.90
5724233.90
58244612.90
59257619.90
60251474.50
612515101.90
6226552.80
632617107.50
642692229.00
65271474.50
66274912.90
6728689.90
68287919.90
69291444.50
70297619.90
7130552.80
723110149.00
73311747.50
743192229.00
75321484.50
7632111189.00
773292229.00
78331737.50
7933121349.00
8034111.20
81351531.90
82358934.90
8336233.90
84361561.90
85368134.90
86367519.90
8737253.90
883791229.00
89381727.50
9038131129.00
9138619.90
9239131.20
933910149.00
94401454.50
954110149.00
96411571.90
9741112189.00
98411727.50
9942213.90
100433108.50
1014317107.50
102431484.50
1034410249.00
104448534.90
105451686.90
10645328.50
107455102.80
10846512.80
109467519.90
110461797.50
11147572.80
11247121349.00
1134710249.00
114473108.50
11548132129.00
116488134.90
11748121349.00
1184841012.90
119498434.90
120491541.90
12149293.90
12249141.20
123501444.50
124504112.90
12550131129.00
12651619.90
12751243.90
12851121349.00
129517719.90
130521727.50
131528134.90
13252358.50
133522103.90
13453132129.00
13553348.50
13653582.80
13754111189.00
138541797.50
13954293.90
1405410249.00
141558934.90
14256679.90
14356112189.00
144571616.90
145574412.90
14657112189.00
14757131129.00
148581656.90
149591571.90
15059111189.00
151594612.90
152608834.90
153601521.90
154611727.50
15561293.90
15661582.80
157624312.90
158621767.50
15963112189.00
160631521.90
161647219.90
162654512.90
16365572.80
164651777.50
1656692229.00
16666121349.00
1676615101.90
16867132129.00
1696792229.00
170674112.90
171681444.50
172681747.50
17368619.90
174698134.90
175707319.90
176701797.50
177701676.90
17870348.50
179711581.90
180717319.90
1817191229.00
18272121349.00
183721434.50
18472131129.00
18572542.80
18673273.90
18773122349.00
188731424.50
1897410249.00
190741484.50
19175112189.00
1927515101.90
19375132129.00
194764812.90
195761676.90
196778634.90
19777121349.00
198781494.50
19978542.80
200781636.90
201795102.80
2028010249.00
203807419.90
20480112189.00
20581122349.00
2068181034.90
2078210249.00
208821551.90
20982318.50
21082649.90
211831474.50
212831551.90
21384689.90
214848134.90
2158491229.00
21684112189.00
217851797.50
21885111189.00
21985121349.00
22085131129.00
221861511.90
22286582.80
223867219.90
22487233.90
225877119.90
22687111189.00
227874512.90
228888734.90
229881511.90
23088629.90
231897619.90
23290122349.00
233901656.90
23490131.20
2359015101.90
236911561.90
2379181034.90
238927619.90
2399216106.90
24093669.90
24193131129.00
242934912.90
24394522.80
24495328.50
2459610249.00
24697112189.00
24797669.90
24897358.50
24998111189.00
25098181.20
2519810149.00
25298659.90
253991646.90
254997519.90
255994412.90
256991777.50
2571007219.90
2581008134.90
2591001727.50
260100669.90
261101388.50
262101121349.00
263101243.90
264102121349.00
265102132129.00
2661027719.90
267102398.50
268103512.80
2691041494.50
270104112189.00
2711041521.90
2721047219.90
273105132129.00
2741058734.90
2751054812.90
2761051676.90
2771067319.90
278107233.90
27910881034.90
2801081531.90
2811087419.90
282108111189.00
283109131.20
2841094212.90
2851091511.90
2861092103.90
2871101666.90
2881104912.90
289110368.50
29011091229.00
291111121349.00
2921111531.90
2931111727.50
294112121349.00
29511210249.00
296112223.90
2971131717.50
29811315101.90
29911392229.00
3001134912.90
3011143108.50
302114532.80
303114273.90
3041148234.90
3051151727.50
3061153108.50
307116659.90
30811691229.00
3091171636.90
3101178934.90
311117171.20
3121171757.50
3131181464.50
314118659.90
315118112189.00
316119639.90
3171191777.50
318119131129.00
3191201777.50
320120542.80
3211204512.90

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

Part 4: slow sellers

Task Part 4: Which products are just sitting there? Show ProductName, UnitsInStock and the stock value (UnitPrice times UnitsInStock) of all products not ordered since 1 Oct 2026, largest stock value first.

Products 18 rows, 6 columns
ProductIDProductNameCategoryIDUnitPriceUnitsInStockDiscontinued
1Blue ballpoint pen11.20121☐
2Highlighter 4-pack13.9076☐
3Hole punch18.50237☐
4Stapler112.9061☐
5Lever arch file12.8076☑
6USB drive 64 GB29.90193☐
7Wireless mouse219.90157☐
8Keyboard234.90216☐
927-inch monitor2229.00129☐
10Headset249.0047☐
11Office chair3189.00135☐
12Desk3349.0046☐
13Mobile pedestal3129.00105☐
14Copy paper A444.5035☐
15Notepad41.90122☐
16Envelopes 100-pack46.9093☐
17Labels47.5075☐
18Laminating pouches411.90211☐
OrderDetails 321 rows, 5 columns
DetailIDOrderIDProductIDQuantitySalePrice
11121.20
221757.50
32122349.00
428334.90
53328.50
64689.90
74348.50
847719.90
9410149.00
105181.20
1154212.90
1251444.50
135121349.00
1461424.50
156131129.00
1677219.90
1778734.90
188572.80
199582.80
209328.50
21108134.90
2210233.90
2310191.20
24111511.90
2511263.90
2611132129.00
271110149.00
2812111189.00
2913131129.00
30131616.90
3114132129.00
3214542.80
33144312.90
34156109.90
35164712.90
36161444.50
37163108.50
381691229.00
39177619.90
40181541.90
41187119.90
421992229.00
4319131129.00
44204612.90
4520582.80
4620122349.00
472017107.50
48218834.90
4921562.80
50217419.90
51211571.90
5222388.50
532392229.00
5423213.90
552491229.00
5624669.90
5724233.90
58244612.90
59257619.90
60251474.50
612515101.90
6226552.80
632617107.50
642692229.00
65271474.50
66274912.90
6728689.90
68287919.90
69291444.50
70297619.90
7130552.80
723110149.00
73311747.50
743192229.00
75321484.50
7632111189.00
773292229.00
78331737.50
7933121349.00
8034111.20
81351531.90
82358934.90
8336233.90
84361561.90
85368134.90
86367519.90
8737253.90
883791229.00
89381727.50
9038131129.00
9138619.90
9239131.20
933910149.00
94401454.50
954110149.00
96411571.90
9741112189.00
98411727.50
9942213.90
100433108.50
1014317107.50
102431484.50
1034410249.00
104448534.90
105451686.90
10645328.50
107455102.80
10846512.80
109467519.90
110461797.50
11147572.80
11247121349.00
1134710249.00
114473108.50
11548132129.00
116488134.90
11748121349.00
1184841012.90
119498434.90
120491541.90
12149293.90
12249141.20
123501444.50
124504112.90
12550131129.00
12651619.90
12751243.90
12851121349.00
129517719.90
130521727.50
131528134.90
13252358.50
133522103.90
13453132129.00
13553348.50
13653582.80
13754111189.00
138541797.50
13954293.90
1405410249.00
141558934.90
14256679.90
14356112189.00
144571616.90
145574412.90
14657112189.00
14757131129.00
148581656.90
149591571.90
15059111189.00
151594612.90
152608834.90
153601521.90
154611727.50
15561293.90
15661582.80
157624312.90
158621767.50
15963112189.00
160631521.90
161647219.90
162654512.90
16365572.80
164651777.50
1656692229.00
16666121349.00
1676615101.90
16867132129.00
1696792229.00
170674112.90
171681444.50
172681747.50
17368619.90
174698134.90
175707319.90
176701797.50
177701676.90
17870348.50
179711581.90
180717319.90
1817191229.00
18272121349.00
183721434.50
18472131129.00
18572542.80
18673273.90
18773122349.00
188731424.50
1897410249.00
190741484.50
19175112189.00
1927515101.90
19375132129.00
194764812.90
195761676.90
196778634.90
19777121349.00
198781494.50
19978542.80
200781636.90
201795102.80
2028010249.00
203807419.90
20480112189.00
20581122349.00
2068181034.90
2078210249.00
208821551.90
20982318.50
21082649.90
211831474.50
212831551.90
21384689.90
214848134.90
2158491229.00
21684112189.00
217851797.50
21885111189.00
21985121349.00
22085131129.00
221861511.90
22286582.80
223867219.90
22487233.90
225877119.90
22687111189.00
227874512.90
228888734.90
229881511.90
23088629.90
231897619.90
23290122349.00
233901656.90
23490131.20
2359015101.90
236911561.90
2379181034.90
238927619.90
2399216106.90
24093669.90
24193131129.00
242934912.90
24394522.80
24495328.50
2459610249.00
24697112189.00
24797669.90
24897358.50
24998111189.00
25098181.20
2519810149.00
25298659.90
253991646.90
254997519.90
255994412.90
256991777.50
2571007219.90
2581008134.90
2591001727.50
260100669.90
261101388.50
262101121349.00
263101243.90
264102121349.00
265102132129.00
2661027719.90
267102398.50
268103512.80
2691041494.50
270104112189.00
2711041521.90
2721047219.90
273105132129.00
2741058734.90
2751054812.90
2761051676.90
2771067319.90
278107233.90
27910881034.90
2801081531.90
2811087419.90
282108111189.00
283109131.20
2841094212.90
2851091511.90
2861092103.90
2871101666.90
2881104912.90
289110368.50
29011091229.00
291111121349.00
2921111531.90
2931111727.50
294112121349.00
29511210249.00
296112223.90
2971131717.50
29811315101.90
29911392229.00
3001134912.90
3011143108.50
302114532.80
303114273.90
3041148234.90
3051151727.50
3061153108.50
307116659.90
30811691229.00
3091171636.90
3101178934.90
311117171.20
3121171757.50
3131181464.50
314118659.90
315118112189.00
316119639.90
3171191777.50
318119131129.00
3191201777.50
320120542.80
3211204512.90
Orders 120 rows, 6 columns
OrderIDCustomerIDOrderDateShippedDateFreightPaymentMethod
11630 Apr 20253 May 20254.90Invoice
22318 May 202526 May 20254.90PayPal
31916 Jul 20264.90Direct debit
41131 Mar 20251 Apr 20250.00Invoice
567 Dec 20259 Dec 20259.90PayPal
61819 May 202626 May 20266.90Direct debit
7715 Jun 202616 Jun 20264.90Credit card
82018 Mar 202519 Mar 20250.00PayPal
91029 Oct 20253 Nov 20250.00Direct debit
10721 Nov 20264.90Invoice
1112 May 202510 May 20259.90Direct debit
12107 Aug 20259 Aug 20250.00Invoice
13317 Sep 202624 Sep 20269.90PayPal
141629 Jan 20261 Feb 20266.90Invoice
15413 Jun 202521 Jun 20254.90PayPal
16123 Nov 202512 Nov 20254.90Invoice
1795 May 20268 May 20269.90PayPal
18926 Sep 20252 Oct 20254.90PayPal
19148 Mar 202610 Mar 20260.00Credit card
2012 Apr 20266.90PayPal
211817 Nov 20264.90PayPal
221127 Jul 20264 Aug 20264.90PayPal
231223 Jun 202628 Jun 20264.90Credit card
241012 Jan 202616 Jan 20260.00Direct debit
25130 Mar 202631 Mar 20264.90Credit card
2633 Mar 20257 Mar 20254.90Invoice
27249 Mar 202511 Mar 20254.90PayPal
28122 Sep 202528 Sep 20254.90PayPal
29118 Feb 202522 Feb 20254.90Invoice
301913 Oct 202518 Oct 20254.90PayPal
311019 Sep 202525 Sep 20256.90PayPal
32619 Jun 202624 Jun 20264.90Credit card
332016 Jun 202622 Jun 20269.90Credit card
341323 May 202627 May 20269.90Direct debit
351624 May 20262 Jun 20264.90PayPal
36149 Nov 202614 Nov 20264.90PayPal
37311 Mar 202618 Mar 20269.90PayPal
38222 Jan 202510 Jan 20250.00Invoice
391221 Oct 202527 Oct 20250.00Invoice
40204 Nov 20265 Nov 20269.90PayPal
411729 Mar 202630 Mar 20264.90PayPal
42136 Jan 20268 Jan 20260.00Invoice
43324 Feb 202626 Feb 20264.90PayPal
44721 Sep 202628 Sep 20264.90Invoice
45217 Apr 202523 Apr 20250.00Direct debit
46727 Apr 202628 Apr 20264.90Invoice
47316 Nov 20266.90Direct debit
48126 Jun 202627 Jun 20264.90Credit card
492429 Apr 202630 Apr 20264.90PayPal
50123 Mar 202528 Mar 20254.90Direct debit
511028 Jan 202631 Jan 20260.00PayPal
52229 May 202615 May 20264.90Direct debit
531029 Dec 20257 Jan 20260.00Credit card
54417 Oct 202618 Oct 20269.90Credit card
552430 Aug 202531 Aug 20256.90Credit card
56629 Jan 20262 Feb 20264.90PayPal
571810 Dec 202513 Dec 20256.90Direct debit
58134 Mar 20259 Mar 20259.90Invoice
591129 Nov 20257 Dec 20256.90Invoice
60930 Oct 20254 Nov 20254.90Invoice
611017 Mar 202619 Mar 20264.90PayPal
62914 Jul 202521 Jul 20254.90PayPal
63824 May 20252 Jun 20250.00Invoice
64429 Sep 20265 Oct 20264.90Invoice
651022 Jan 202627 Jan 20269.90Invoice
66927 Mar 202628 Mar 20269.90Credit card
671411 Sep 202618 Sep 20264.90PayPal
6849 Jun 202616 Jun 20260.00Invoice
691710 Jan 202617 Jan 20269.90Credit card
70211 Apr 20262 Apr 20264.90Credit card
711519 Mar 202521 Mar 20254.90Credit card
72204 Mar 20256 Mar 20254.90Invoice
731024 May 20259.90PayPal
7483 Jan 20254 Jan 20259.90Invoice
752330 Oct 20256 Nov 20259.90Direct debit
762230 Aug 20253 Sep 20256.90Invoice
77218 Nov 202523 Nov 20256.90PayPal
78322 Dec 202526 Dec 20254.90Invoice
792126 May 20266.90Invoice
802423 Feb 202627 Feb 20264.90Direct debit
8125 Jun 20266.90PayPal
821114 Aug 20266.90Invoice
832110 May 202618 May 20269.90Credit card
841312 Feb 202519 Feb 20254.90Credit card
85222 Jan 202630 Jan 20264.90PayPal
86231 Oct 20254 Nov 20259.90Credit card
8769 Mar 202517 Mar 20259.90Credit card
8835 Feb 202514 Feb 20259.90Direct debit
891726 Jan 202529 Jan 20256.90PayPal
901125 Sep 20264.90Direct debit
912223 May 20251 Jun 20254.90Credit card
922029 Jan 20252 Feb 20250.00PayPal
93816 Jul 202618 Jul 20266.90Invoice
9427 Aug 202510 Aug 20250.00Invoice
95226 Jan 20258 Jan 20256.90Credit card
961515 Dec 202524 Dec 20254.90Invoice
97623 Sep 202530 Sep 20256.90Invoice
981010 Sep 202516 Sep 20250.00Invoice
991410 Jan 202613 Jan 20269.90Credit card
1001620 Nov 202524 Nov 20250.00Credit card
1011826 Jul 202627 Jul 20264.90Credit card
102215 May 20259.90Invoice
10348 Feb 202515 Feb 20256.90Credit card
104716 Sep 202617 Sep 20264.90Invoice
105726 Jan 202531 Jan 20254.90Direct debit
106232 Aug 20263 Aug 20266.90Direct debit
1071322 Jan 202626 Jan 20269.90Credit card
10846 Oct 202514 Oct 20254.90Direct debit
109106 Nov 20259 Nov 20254.90Direct debit
110917 Oct 202618 Oct 20269.90PayPal
1112324 May 202625 May 20266.90Direct debit
112231 Aug 20251 Sep 20259.90Direct debit
1132025 Jul 202628 Jul 20260.00Direct debit
114624 Nov 202527 Nov 20259.90Credit card
115827 Nov 202530 Nov 20256.90Credit card
116118 Mar 202525 Mar 20250.00Direct debit
117916 Mar 202519 Mar 20256.90Credit card
118410 Jul 202615 Jul 20260.00Invoice
1191423 Jun 202528 Jun 20254.90Direct debit
120221 Sep 202627 Sep 20264.90Direct debit

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

Rebuild it in real Access

  1. First make a copy of the .accdb file.
  2. For part 1, run the subquery on its own and look at the orders, only then the UPDATE query.
  3. Parts 2 and 3 in turn: archive, count in the archive, then delete.
  4. Save part 4 as a select query; it stays current every month.

What you learned in level 4

  • Writing queries directly in SQL view and the quirks of Access SQL.
  • Action queries: UPDATE, DELETE, INSERT INTO, SELECT … INTO.
  • Union queries with UNION and UNION ALL.
  • Subqueries as a value, with IN, NOT IN and EXISTS.
  • Domain functions DLookup, DSum and DCount.

Level 5 builds the user interface: forms with combo boxes and subforms, reports with groups and totals. The overview is on the Access page.

Write to us

Choose language

Select your preferred language