ExamBank Scot · Higher Computing Science question bank · All Higher Computing Science questions
3 marks · Aggregate functions and grouping
A decorating company uses a database to keep track of the work they carry out. Sample data from the database is shown below. Job jobID jobDescription billedCost expenses AT44 Exterior walls painted 800.00 600.00 PD27 Chandelier polished and rehung 400.00 175.00 BC99 Lounge wallpapered 350.00 180.00 BF89 3 bedrooms wallpapered 750.00 475.00 BH49 2 exterior doors painted 320.00 100.00 NF77 Exterior woodwork varnished 470.00 300.00 AB73 Windowsill repainting 80.00 42.00 BD14 Kitchen ceiling painted 250.00 150.00 SC45 Repaint hallway ceiling 250.00 136.00 HL19 Painting of stairway banister 400.00 250.00 WE99 3 ceilings plastered and painted 550.00 375.00 HT83 Install and paint balcony banister 700.00 100.00 KL65 Dining room painted 375.00 180.00 NV22 Varnish dining room floor 350.00 100.00 GH99 Wallpaper entrance hallway 1000.00 650.00 … … … … The company wants to know the total profit from all jobs involving paint. Profit is calculated by subtracting the expenses from the billed cost. Write the SQL statement to calculate the total profit and display it as shown below. Total profit 1792.00
• SUM • calculation and alias • use of wildcards in search criteria Note: Access will use * Accept SUM(billedCost) SUM(expenses)for bullet 1/2. Example answer: SELECT SUM(billedCost – expenses) as [Total profit] FROM Job WHERE jobDescription LIKE ‘%paint%’
Previous question: Higher Computing Science 2026 Question 12