Two-attribute relations {country, caliber} are joined in the sub query. The second query predicate is the following:
NOTEXISTS(SELECT1
FROM Ships S
WHERE s.Name = O.Ship
)
It eliminates possibility of multi-counting the ship if this ship is present in both Ships and Outcomes tables. This justifies the use of UNION ALL operator. Duplicates which can appear in case of ship participating in multiple battles are excluded by grouping by country and caliber.
However, consider a case when a country has several classes of ships with the same caliber and these ships are present in the Outcomes table. As the result, only one ship would be counted, instead of several times what makes the given solution a mistaken.