Outer Join

Filter in WHERE Clause versus Filter in ON clause

Sometimes SQL developers ask me if there is a difference between putting the Filter in the WHERE Clause and putting the Filter in the ON Clause and if yes, what the difference is. To explain it the best I have stolen a little example (Source at the end):

CREATE TABLE department (
  department_id   INT UNSIGNED NOT NULL
, department_name VARCHAR(14)
, location        VARCHAR(13)
, PRIMARY KEY (department_id)
);

INSERT INTO department (department_id, department_name, location)
VALUES
  (10, 'ACCOUNTING', …
Subscribe to RSS - Outer Join