Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Database Exercise 6.5.2 write the following database modifications, based on the

ID: 669166 • Letter: D

Question

Database

Exercise 6.5.2 write the following database modifications, based on the database schema

Classes(class, type, country, numGuns, bore, displacement)
Ships(name, class, launched)
Battles(name, date)
Outcomes(ship, battle, result)

Based on Exercise 6.5.2 (page 295-296). 1 pt. per query 1. The two British battleships of the Nelson class Nelson and Rodney - were both launched in 1927, had 12 16-inch guns, and a displacement of 35,000 tons. Insert these facts into the database. 2. Two of the three battleships of the Italian Vittorio Veneto class Vittorio Veneto and Italia were launched in 1939; the third ship of that class, Roma, was launched in 1941. Each had 10 14-inch guns and a displacement of 42,000 tons. Insert these facts into the database Delete from Shipe all be i uk i buttle 3. Delete from Ships all the ships sunk in battle 4 Modify the Classes relation so that gun bores are measured in centimeters (1 inch = 2.54 centimeters) 5. Delete all classes with two or fewer ships. 6. Each class is required to have a ship with the class name launched the same year the first ship in the and displacements are measured in metric tons (1 metric ton -1.15 tons) class was launched. Add this fact to the database, for all the classes that do not satisfy it

Explanation / Answer

There are multiple subparts to this question. I have answered the first 3. Can you please post 1 more question for the next sub-part.

the table can be created with below command

CREATE TABLE Classes (

class CHAR(20),

type CHAR(5),

country CHAR(20),

numGuns INTEGER,

bore DECIMAL(3,1),

displacement INTEGER

)

Insert into classes (class, type, country, numGuns, bore, displacement) values ("Nelson","ship","British",12,16,35000)

Insert into Ships("Nelson","Nelson",1927)

Insert into Ships("Rodney","Nelson",1927)

2)

Insert into classes (class, type, country, numGuns, bore, displacement) values ("Vittorio","ship","Italian",10,14,42000)

Insert into classes (class, type, country, numGuns, bore, displacement) values ("Venoto","ship","Italian",10,14,42000)

Insert into classes (class, type, country, numGuns, bore, displacement) values ("Roma","ship","Italian",10,14,42000)

3)

Delete * from ships S

FROM Classes C, Ships S

WHERE C.class = S.class

AND EXISTS

(SELECT ship

FROM Outcomes O

WHERE O.result='sunk'

AND O.ship = S.name )