title: SQL update statement can insert NULL value to foreign key column
body: <p>I have below two tables:</p>
  
  <pre><code>EMPLOYEE (employee_ID  primary key)(Foreign key Department_id reference department(department_id))
  </code></pre>
  
  <pre>employee_id First_name  Last_name  Department_id  Salary  Commission<br>
  154         Aaan        Eaan         80            6000    0.2<br>
  166         Baan        Faan         80            7000    0.1<br>
  167         Caan        Gaan         80            7000    0.3<br>
  169         Daan        Haan         80            8000    0.4<br></pre>
  
  <p>DEPARTMENTS(Department_id  primary key)</p>
  
  <pre>Department_id  Dept_name  location<br>
  10             AA         1700<br>
  40             BB         1800<br>
  70             CC         1900<br>
  80             DD         2000<br></pre>
  
  <p>I have below update code</p>
  
  <pre>
  UPDATE employee a
  SET department_id=(select department_id 
                     from departments
                     where location = 2100),
      (salary,comission)=(select 1.1*AVG(salary), 1.5*AVG(comission)
                          from employee b
                          where a.department_id = b.department_id)
  where first_name||' '||last_name = 'Caan Gaan';
  </pre>
  
  <p>My questions is will above code execute? There is no location 2100 in departments table, will null value inserted?Please help</p>