Write the following as assertions. The database schema is from the battleships C
ID: 3823105 • Letter: W
Question
Write the following as assertions. The database schema is from the battleships
Classes(class, type, country, numGuns, bore, displacement)
Ships(name, class, launched)
Battles(name, date)
Outcomes(ship, battle, result)
a) No class may have more than 2 ships.
b) No country may have both battleships and battlecruisers.
c) No ship with more than 9 guns may be in a battle with a ship having fewer than 9 guns that was sunk.
d) No ship may be launched before the ship that bears the name of the first ship’s class.
e) For every class, there is a ship with the name of that class.
Explanation / Answer
The assertions are as follows:
a) A class can have at most 2 ships.
b) A country can have either battleships or battlecruisers.
c) A ship can have at most 9 guns if it is in a battle with a ship having less than 9 guns that was sunk.
d) A ship can be launched only after a ship that bears the first ship's class.
e) There is no class without a ship with the name of that class.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.