In this lab, we will continue working on the Sakila database of movie rentals.
Write queries to answer the following questions:
- Write a query to find what is the total business done by each store.
- Convert the previous query into a stored procedure.
- Convert the previous query into a stored procedure that takes the input for
store_id
and displays the total sales for that store. - Update the previous query. Declare a variable
total_sales_value
of float type, that will store the returned result (of the total sales amount for the store). Call the stored procedure and print the results. - In the previous query, add another variable
flag
. If the total sales value for the store is over 30.000, then label it asgreen_flag
, otherwise label is asred_flag
. Update the stored procedure that takes an input as thestore_id
and returns total sales value for that store and flag value.