Question 8:
Create a trigger named Tri_Del for the delete statement on table stocks so that when we delete one or more rows from the table stocks, the system will display the product_id,product_name, store_id, store_name, quatity corresponding to the rows that have been deleted.
For example, when we execute the following statement, the results should be as in the following figure:
DELETE FROM stocks
WHERE product_id IN (2,7,12,15) AND store_id=2
Results Messages
product_id product_name
15
12
7
2
Electra Moto 1-2016
store_id
2
Baldwin Bikes 2
Electra Townie Original 21D-2016 2
Baldwin Bikes 8
Trek Slash 8 27.5-2016
2
Baldwin Bikes 16
1
2
3
4
7 of 7
Ritchey Timberwolf Frameset-2016 2
store_name
quantity
Baldwin Bikes 6
Paper No: 1
Picture 8.1
Question 9:
Create a store procedure named staff_order to count order of the staff where @staffid int is an input parameter and @countOrders int is an output parameter of the procedure.For example, when we execute the procedure staff_order by using the following statements,
the result should be as in the following figure:
declare @x int
exec staff_order 3, @x output
+ 100%
Zoom
Close