Reputation: 54094
I see that this SQL statement works:
SELECT *
FROM Company
LEFT JOIN (
Departments
INNER JOIN Employees
ON Departments.dep_id = Employees.Dep_ID
) ON Company.compId = Departments.Comp_ID;
But this statement:
Departments INNER JOIN Employees ON Departments.dep_id = Employees.Dep_ID
can not be parsed.
Is this meant to be a short version only for subqueries?
Upvotes: 0
Views: 64
Reputation: 20804
This:
Departments INNER JOIN Employees ON Departments.dep_id = Employees.Dep_ID
cannot be parsed because it is not a complete query. It is missing the opening clause, which in this case is a select clause. Other options for an opening clause are insert, update, or delete.
It is also missing the keyword "from". Also, while not mandatory, most select queries have a where clause to get just the records they want, as opposed to the entire database.
Upvotes: 3