Answered step by step
Verified Expert Solution
Link Copied!

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

  1. Make SQL Triggers
  2. Make a table

Requirements:

 

Make the following SQL triggers:

  1. 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)

 

  1. 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)
  2. 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)

 

  1. 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)

 


Screenshot 2023-12-07 194849.png




 

 


Screenshot 2023-12-07 194919.png


 

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Databases questions