Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Make SQL Triggers Make a table Requirements: Make the following SQL triggers: Make a trigger called TR_1 to ensure that thePricein the Service table
- Make SQL Triggers
- Make a table
Requirements:
Make the following SQL triggers:
- Make a trigger called TR_1 to ensure that the Price in the Service table does not increase by more than 12% at a time. Should this happen, raise an error, and prevent the operation from occurring. (4 marks)
- Due to limited capacity, a booking is only allowed to have a maximum of 4 Dog Services! Make a trigger called TR_2 to ensure that a booking does not have more than four Dog Services. If an attempt is made where a booking would have more than 4 Dog Servers, raise an error, and prevent the operation from occurring. (5 marks)
- To attract more clientele, Doggy Day Care wants to keep all Service Prices $100 or less! Make a trigger called TR_3 to ensure Service Prices do not go above $100. If an attempt is made to update any Service Price above $100, set that price or prices to $100. (4 marks)
- In order to price services appropriately, Doggy Day Care would like to track changes to the prices of their services. Make a trigger called TR_4 to log changes to the price of Services. When the price of one or more services changes, add a record for each service that actually changed prices (prices that were updated to the same price they already were should not be logged) to the LogPriceChanges table. The LogPriceChanges table is included in the Lab4Data.sqlfile. (4 marks)
LogPriceChanges PK LogPricelD int dentity (1.1) DateAndTime smalldatetime ServicelD varchar(20) OldPrice smallmoney NewPrice smallmoney
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started