CTS2437 Final Exam SQL Server Administration
- December 17, 2020
- Posted by: admin
CTS2437 – Final Exam
Provide the SQL statements required to accomplish the following tasks.
#1 (10 points)
Create a database named FINAL_EXAM that you will then use for all remaining problems.
#2 (20 points)
Create the tables and appropriate constraints based on the following ER diagram. Use appropriate data types. Note that the size column should only accept S, M, or L. In addition the price column should have values greater than zero. All columns in both tables are required.
#3 (5 points)
Insert 3 rows in the Category table. The db is for a small shoe store, so use appropriate data for the description ( “Men”, “Women”, “Children”)
#4 (5 points)
Insert 3 Product records for each category in the product table. Use whatever data you see as appropriate.
#5 (5 points)
Use one statement to increase the price of all products in the Men category by 25%.
#6 (5 points)
Use one statement to delete all products for the Children category.
#7 (10 points)
Create and execute a view named EXAM_VIEW that shows all columns from both tables. Use an inner join.
#8 (10 points)
Create a database trigger named EXAM_TRIGGER that prevents a user from deleting a Product record on Tuesdays. Display an appropriate error message. Make sure to show that the trigger is working properly.
#9 (10 points)
Create a stored procedure named SP_EXAM that will be used to insert records into the Product table. Make sure to show that the procedure is working properly.
#10 (5 points)
Remove the EXAM_VIEW object from the database.
#11 (5 points)
Remove the SP_EXAM stored procedure from the database.
#12 (5 points)
Remove the EXAM_TRIGER database trigger from the database.
#13 (5 points)
Remove the FINAL_EXAM database.