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)
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 )
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.