21:21

# Exercise #46 page 1

Point out the names, displacements and number of guns of ships participating in the battle at Guadalcanal.

The all ships which had taken part in the battle of Guadalcanal is in the Outcomes table, and all the characteristics is in the Classes table. The first occured idea is in the joining of this tables:

Solution 3.1.1

Console
Execute
`SELECT Outcomes.ship, Classes.displacement, Classes.numGuns FROM Classes RIGHT JOIN Outcomes ON Classes.class = Outcomes.ship WHERE Outcomes.battle = 'Guadalcanal';`

The outer join is using correctly, because task says about ships which had taken part in battle, so we need to select all ships, no matter the name matches the class name or it does not. Note that the inner join returns empty set, because there is no lead ships in the main database which take part in this battle. So we have:

ship displacement numGuns
California NULL NULL
Kirishima NULL NULL
South Dakota NULL NULL
Washington NULL NULL

Ship displacement numGuns
California 32000 12
Kirishima 32000 8
South Dakota 37000 12
Washington 37000 12

 Pages 1 2 3