By default, the Query Designer creates an
When you create an outer join, the order in which tables appear in the SQL statement (as reflected in the SQL pane) is significant. The first table you add becomes the "left" table and the second table becomes the "right" table. (The actual order in which the tables appear in the Diagram pane is not significant.) When you specify a left or right outer join, you are referring to the order in which the tables were added to the query and to the order in which they appear in the SQL statement in the SQL pane.
To create an outer join
or
In the Diagram pane, right-click the join line you want to change to an outer join, and then choose Properties from the shortcut menu. Under Include rows in the Join Line tab of the Properties dialog box, choose the option specifying the table from which you want to include all rows.
When you specify an outer join, the Query Designer modifies the join line to indicate an outer join.
In addition, the Query Designer modifies the SQL statement in the SQL pane to reflect the change in join type, as shown in the following statement:
SELECT employee.job_id, employee.emp_id,
employee.fname, employee.minit, jobs.job_desc
FROM employee LEFT OUTER JOIN jobs ON
employee.job_id = jobs.job_id
Because an outer join includes unmatched rows, you can use it to find rows that violate employee
table that do not have corresponding rows in the jobs
table:
SELECT employee.emp_id, employee.job_id
FROM employee LEFT OUTER JOIN jobs
ON employee.job_id = jobs.job_id
WHERE (jobs.job_id IS NULL)
How the Query Designer Represents Joins | Querying Using Multiple Tables | Types of Joins