Reputation: 830
When querying an Oracle DB:
If the query is a select with joins, does the syntax have to include the keywords:
If not, then what are the alternative usages/syntax?
I ask this because I am looking at a SELECT statement that does not use any of the JOIN keywords within the FROM clause, but includes the joining syntax within the WHERE clause, and I am wondering:
Example:
SELECT e.name, e.employeeid, d.sales, d.task, sum(d.hours)
FROM employee e,
timecard d,
WHERE e.employeeid = d.employeeid and
GROUP BY ...
ORDER BY ...
Upvotes: 0
Views: 147
Reputation: 152521
That example is equivalent to an INNER JOIN. The equivalent (deprecated) syntax in Oracle for a LEFT join would be
SELECT e.name, e.employeeid, d.sales, d.task, sum(d.hours)
FROM employee e,
timecard d,
WHERE e.employeeid = d.employeeid(+) and
GROUP BY ...
ORDER BY ...
Upvotes: 1
Reputation: 9819
Yes, this is a (inner) join, and could be rewritten as
SELECT e.name, e.employeeid, d.sales, d.task, sum(d.hours)
FROM employee e
JOIN timecard d on e.employeeid = d.employeeid
WHERE ...
GROUP BY ...
ORDER BY ...
Upvotes: 2