title: MySQL query, three tables, outer join
body: <p>EDIT: Answer:</p>
  
  <pre><code>SELECT c.Name FROM Country c
  WHERE NOT EXISTS 
  ( SELECT * FROM City 
  JOIN Building ON City.CityID = Building.CityID 
  WHERE City.CountryID = c.CountryID);
  </code></pre>
  
  <p>Thank you for your time guys.</p>
  
  <p>I have schema like this:</p>
  
  <p><a href="https://i.stack.imgur.com/tCT0H.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tCT0H.png" alt="enter image description here"></a></p>
  
  <p>I did something like this to select all cities with no buildings.</p>
  
  <pre><code>select * from City c 
    left join Building b on b.CityID = c.CityID
    where b.CityID is null or c.CityID is null
    union all
    select * from City c 
    right join Building b on b.CityID = c.CityID 
    where b.CityID is null or c.CityID is null;
  </code></pre>
  
  <p><strong>How to select names of countries with no buildings?</strong></p>
  
  <p>Table description:
  <a href="https://i.stack.imgur.com/ifSCk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ifSCk.png" alt="enter image description here"></a></p>
  
  <ol>
  <li>Data example:</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/17WvX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/17WvX.png" alt="enter image description here"></a></p>
  
  <p>2.Output expected:
  England</p>