I'm looking into converting an Oracle query into SQL Server query and I am a little confused as I want to make sure I'm understanding it correctly...
Say I have a query..
Select t1.Name, t2.Address, t3.Num
From t1, t2, t3
Where t1.code = t2.othercode
and t2.Id = t3.otherId
and t3.Indicator = 'N'
Now the FROM
statement - this means that they are all INNER JOINED
automatically? but I am not specifying what FIELDS
they are joined on? My question basically is, is the WHERE clause in Oracle what I should be JOINING on in my FROM part of the query as in:
SELECT t1.Name, t2.Address, t3.Num
FROM t1
JOIN t2 ON t1.code = t2.othercode
JOIN t3 ON t2.id = t3.otherId AND t3.indicator = 'N'
Would the above 2 queries do the same?
I don't have exact data in Oracle as I do in SQL Server and I'm trying to make sure my logic is sound.
Thanks.
Your join
query is equivalent to the version with commas. The queries should be functionally equivalent (return the same result set). I would actually expect them to produce the same execution plans.
That said, you should write the query using join
in both databases. That has been the preferred syntax for more than two decades (in general: Oracle was a little late to the party).
And both databases should handle the query with commas -- databases do still support the archaic syntax. So, you can test the version with join
in Oracle and validate that it produces the same result set.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.