One exercise in our MySQL 5.0 for Developers asks for the list of country names where people speak French but not English. Of course, the world sample database is required for this.
The typical solution which we also provide in ouur training material goes like this. SELECT Country.Name FROM Country JOIN CountryLanguage ON Country.Code=CountryLanguage.CountryCode WHERE CountryLanguage.Language='French' AND CountryLanguage.CountryCode NOT IN (SELECT CountryCode FROM CountryLanguage WHERE Language='English');
You can also use subselects only. SELECT Name FROM Country WHERE Code IN (SELECT CountryCode FROM CountryLanguage WHERE Language = 'French' AND CountryCode NOT IN (SELECT CountryCode FROM CountryLanguage WHERE Language = 'English'));
This weeks class came up with a simple solution not using any subselect at all.