title: SQL statement select columns with specific value
body: <p>I need some help making an sql statement; I don't really know how to aproach the situation. I have two tables, Departments and Employees
  from which I want to select the <em>Dpt_num</em> and the <em>Dpt_name</em> of the departments that have at least one employee and that all their employees are from Barcelona</p>
  
  <p><strong>Case 1</strong></p>
  
  <pre><code>== Departments =======
  | Dpt_num | Dpt_name |
  |    1    |    A     |
  |    2    |    B     |
  
  == Employees ===================
  | E_num | Dpt_num |  City      |
  |  1    |   1     | Barcelona  |
  |  2    |   1     | Barcelona  |
  </code></pre>
  
  <p>The result in this case should be</p>
  
  <pre><code> Dpt_num Dpt_name
   ------------------
      1       A
  </code></pre>
  
  <p><strong>Case 2</strong></p>
  
  <pre><code>== Departments =======
  | Dpt_num | Dpt_name |
  |    1    |    A     |
  |    2    |    B     |
  
  == Employees ==================
  | E_num | Dpt_num | City      |
  |   1   |    1    | Barcelona |
  |   2   |    1    | Madrid    |
  </code></pre>
  
  <p>The result in this case should be empty.</p>
  
  <p>I tried this for example but it seems very inefficient and it does not work in all the cases</p>
  
  <pre><code>select
      num_dpt, nom_dpt
  from
      departements
  where
      1 = (select count(distinct e.ciutat_empl)
           from empleats e
           where e.num_dpt = num_dpt)
      and not exists (select * from empleats e
                      where e.ciutat_empl != 'BARCELONA' and e.num_dpt = num_dpt);
  </code></pre>
  
  <p>I really appreciate any help. Thanks!</p>