SQL Exception JOIN: How to Write Correctly

The use of JOINs as everyone knows is to get data from multiple tables. Exception JOIN is one kind of JOIN. The most powerful use is to get data that for not satisfied condition of JOINs. The below SQL describes on how to use Exception JOIN and the result how it retrieves.

SELECT LastName, Area

FROM Employee

EXCEPTION JOIN Department

ON Employee.Dept = Department.Dept

Return list of employees only if they are NOT in a valid department

Employee ‘Smith’ is only one without a valid department.

EmployeeName                  Dept
--------------               ------
Smith                         Null

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.