Does the ANSI Standard find the following SQL sinppet syntactically correct? I am interested specifically in the last line:
SELECT name, dept_name
FROM employee JOIN department
ON employee.dept_id = department.dept_id
JOIN payroll ON payroll_type = 1;
Best Answer
Yes, it is syntactically correct.
The
ON
clause can be any boolean expression - i.e. as long as it results in a boolean value (TRUE
,FALSE
,UNKNOWN
).Note that you have 3 tables that are visible in that
ON
clause:employee
,department
andpayroll
. You'll get an error ifpayroll_type
is a column in more than one of them.