Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Exercise 7.5.3: Write the following as triggers. In each case, disallow or undo the modification if it does not satisfy the stated constraint. The database
Exercise 7.5.3: Write the following as triggers. In each case, disallow or undo the modification if it does not satisfy the stated constraint. The database schema is from the battleships example of Exercise 2.4.3. classes (class, type, country, numGuns, bore, displacement) Ships (name, class, launched) Battles (name, date) Outcomes (ship, battle, result) a) When a new class is inserted into classes, also insert a ship with the name of that class and a NULL launch date. b) When a new class is inserted with a displacement greater than 35,000 tons, allow the insertion, but change the displacement to 35,000. ! c) If a tuple is inserted into Outcomes, check that the ship and battle are listed in Ships and Battles, respectively, and if not, insert tuples into one or both of these relations, with NULL components where necessary. ! d) When there is an insertion into Ships or an update of the class attribute of Ships, check that no country has more than 20 ships. !! e) Check, under all circumstances that could cause a violation, that no ship fought in a battle that was at a later date than another battle in which that ship was sunk
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