I have following database
- Customer (customerNO, customerName, address, city, category, custBalance)
- Product (productNO, label, price, QStock)
- CustomerOrder (orderNO, orderDate, #customerNO)
- OrderedProduct (#orderNO, #productNO , orderQuantity )
and want to create these programs
First one is: a stored function called productPerOrder
to return the number of products placed for any order its number is given as input.
Second one: a trigger called changeCustomer_Category
which should be invoked before any update of customer balance in customer table. Its job is to modify the category of a customer from B2 to B1 and from C2 to C1 when a customer's balance status drops below a certain threshold (-10000).