6 of 6
Paper No: 1
[1 mark]. Write a query to find the highest list_price of products within each category_name.
The result includes columns: category_name, product_id, product_name, and list_price, then
sort in ascending order by category_name and product_id as follows.
category_name product_id
product_name
list_price
1
BMX
13
BMX Spark
149.00
2
City
7
City Pro
399.00
E-Bike
12
E-Mountain 500
2199.00
4
Foxie
15
Foxie Basic
219.00
5
Folding
9
Folding Go
379.00
6
Gravel
8
Gravel GX
999.00
7
Hybrid
17
Hybrid H3
649.00
8
Kids
10
Kids Fun 14
149.00
9
Mountain
5
Mountain X2
799.00
10 Road
3
Roadster 300
699.00
11
Touring
14
Touring T1
899.00
Picture 7.1
Question 8:
[1 mark] Create a store procedure named proc_SumQuantityProduct to calculate the total
products quantity of each store_id.
Where @Store_id int is an input parametter and @SumQuantity Decimal(10,2) is an output
parameter of the procedure.
For example, when we execute the procedure proc_SumQuantityProduct by using the
following statements the result should be as in the following figure.
DECLARE @X DECIMAL(10,2)
EXEC proc_SumQuantityProduct 2, @x OUTPUT
SELECT @x SumQuantityProduct
Zoom
+ 100%
Close