100%
LESSONS & TOPICS

3-Create views and automate the database with functions and triggers

3-Create views and automate the database with functions and triggers

Assignment One

All the appointments for Daisy’s will be in the appointment table. Meaning that even when an appointment is “complete“, they will still exist there. Please create two MySQL views for this assignment. One is for “pending” appointments and another is for “complete” appointments. They could be titled “pending_appointments” and “complete_appointments.”

Assignment Two

For this assignment, please create a MySQL function. The function will be named “price“, and it will take three boolean values as the arguments. The three boolean values will be appointment_bath, appointment_haircut, and appointment_the_works. These boolean values will indicate what services should be considered for the price.

This function will take the three arguments and return the price that will be billed for that appointment. The price will be a total of the services that were involved with the appointment. A bath costs $20, a haircut costs $25, and the works costs $35. After adding up the service costs, there is a 15% addition for taxes and other costs. The return value should not have more than two decimal points as it will represent dollars and cents.

Assignment Three

For this assignment, set up a MySQL trigger so that whenever the status of an appointment becomes “complete” it will create a new entry in the billing table. The billing date will be the date that the status was changed, and the billing price will be created accordingly based on the services that were involved with the appointment.

Once you’re done with the assignments so far, please try testing out some of the features that you’ve created!