Key: PrimaryKey ForeignKey
1. Write the following constraints as tuple-based CHECK constraints
a) No class of ships may have guns with larger than a 16-inch bore
b) If a class of ships has more than 9 guns, then their bore must be no larger than 14 inches
c) No ship can be in a battle before it is launched
2. Write the following as triggers:
a) When a new outcome is inserted, check that the launch date for the ships is earlier than the battle date. If it is not, set the launch date for the ship to be 1 month earlier than the date of the battle.
b) When a class is inserted set the country to "USA" if no country is provided (is NULL or empty string).
3. Write the following using stored procedures and functions:
a) Write a procedure "Cooperation" that takes the names of two countries and clones all the ship classes from the first country as classes of the second country.
b) Write a function "LikelyWinner", that given the names of two countries returns the name of the country with the most ships.