MySQL RateModel(cid, m, r) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

MySQL RateModel(cid, m, r)

Write a stored procedure RateModel(cid, m, r) which inserts a new rating r for model m by customer cid into table ratings. The rating_time should be the current date and time. This procedure allows rating NULL to be inserted only if the previous rating of model m by cid is not NULL. This procedure also updates the discount for this cid in table customers as follows. If a customer has rated 5 or more products (counting only non-NULL current ratings) and their discount in table customers is less than 10.0 then change their discount in table customers to 10.0.

28th Nov 2021, 5:26 PM
A.K2002
1 Answer
28th Nov 2021, 10:28 PM
Simon Sauter
Simon Sauter - avatar