Find the name of the ships that are steered by both a captain with Midshipman rank and a captain with Lieutenant rank.
CREATE TABLE ship (name VARCHAR, ship_id VARCHAR); CREATE TABLE captain (ship_id VARCHAR, rank VARCHAR)
[SQL] SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id WHERE t2.rank = 'Midshipman' INTERSECT SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id WHERE t2.rank = 'Lieutenant' [/SQL]