The Pervasive PSQL database engine has implemented LEFT OUTER JOIN using SQL92 (SQL2) as a model. The syntax is a subset of the entire SQL92 syntax which includes cross joins, right outer joins, full outer joins, and inner joins. The TableRefList below occurs after the
FROM keyword in a
SELECT statement and before any subsequent
WHERE, HAVING, and other clauses. Note the recursive nature of TableRef and LeftOuterJoin—a TableRef can be a left outer join that can include TableRefs which, in turn, can be left outer joins and so forth.
The search condition (SearchCond) contains join conditions which in their usual form are LT.ColumnName = RT.ColumnName, where
LT is left table,
RT is right table, and
ColumnName represents some column within a given domain. Each predicate in the search condition must contain some non-literal expression.
The syntax in the previous section includes but goes beyond the ODBC syntax in the Microsoft ODBC Programmer’s Reference. Furthermore, the vendor string escape sequence at the beginning and end of the left outer join does not change the core syntax of the outer join.
Notice the NULL entry for Franky Avalon in the table. That is because no DeptID of D103 was found in the
Dept table. In a standard (
INNER) join, Franky Avalon would have been dropped from the result set altogether.
If there is no right table row where the ON condition is
TRUE, (it is
FALSE for all right table rows given the current left table row), create a row instance of the right table with all column values
NULL.
This query returns the same results as shown in Table 42, assuming there are no
NULL values for EmpID in Emp and EmpID is a unique valued column. This query, however, is not optimized as well as the one show for Table
42 and can be much slower.