Task 6(ships)

–For each country, determine battles in which the ships of the given country did not participate.

–Result set: country, battle

select y.country, name from

(

select distinct country from Classes) y

CROSS

join

(

select name from Battles) z

where

name not in

(

select battle from

(select battle, country from Classes c

inner join ships s on s.class = c.class

inner join Outcomes o on s.name = o.ship

union

select battle, country from Classes c

inner join Outcomes o on o.ship = c.class) u

where u.country = y.country

)

order

by y.country

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s