Skip to content
Gallery
csH2019paper
Share
Explore
section 1

icon picker
q-6 database development

2019 Computing Science Higher SQA paper
You can run and edit code on this page to explore the question and better understand the concepts
aggregate functions,
group by,
column alias
Here is a database table with information about a menu
Dishes
dishName
course
price
portions
1
Chicken wings
Starter
8.99
2
2
Baked Haddock
Main
15.99
1
3
Soup of the day
Starter
2.50
1
4
Pate
Starter
2.99
2
5
Brownies to share
Dessert
8.99
2
6
Panacotta
Dessert
6.00
1
7
Mushroom risotto
Main
9.99
1
8
Chicken curry
Main
12.99
1
9
Mixed platter
Starter
14.99
4
There are no rows in this table

What is the output from this SQL code ?
select course, min(price) as 'least expensive item'
from bistro
where portions >= 2
group by course
(you can copy and run the code in the repl block):
-- paste the output here



Additional question
How would you create this output, the most expensive dessert course and main course?
course most expensive item
---------- --------------------
Dessert 8.99
Main 15.99
(you can edit and run the code in the repl block: query.sql):
Loading…
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.