Question: Problem 5 ( 1 5 points ) : Write an SQL query to create a trigger that ensures no employee spends more than 5 0

Problem 5(15 points):
Write an SQL query to create a trigger that ensures no employee spends more than 50 hours a week on a particular project.
Additionally, write an INSERT statement where you try to add more than 50 hours a week for a particular project for an employee, and display the error message that you would receive.
Problem 6(10 points):
Using the Store database, create a view that extracts all the information (all attributes from the customers table) about customers who live in NY state. The view should always include data regarding customers who live in NY. If a user attempts to insert or update the state to anything other than NY, the DBMS should throw an error. (Don't use triggers for this question) Additionally, write an insert statement for the view where you try to insert a new customer with a state other than NY, and provide a screenshot of the error message you receive from this attempted insert.
Problem 7(10 points):
Using the Store database, write a query that ensures that if a customer is deleted from the customers table, the corresponding orders associated with this customer are also deleted.
(Modify the structure of the existing table(s) where needed; do not create new tables)
Additionally, write an SQL query to delete the customer with customerID =1. Then, display the customers and orders tables to show that the deletion was automatically propagated in both tables.
Problem 8(10 points):
Using the Store database, write a query that displays the total number of customers registered in each month of the year 2023, and display the output in descending order based on the Total_Registered_Customers column.
Display the following columns: Month and Total_Registered_Customers.
Problem 5 ( 1 5 points ) : Write an SQL query to

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!