FULL OUTER JOIN. To be fair, the person who asked me the question is working with a venerable codebase and the project standard is to use the old joining syntax. There is one other thing. Last year I worked on a SQL Server project. It was my first taste of T-SQL. Although overall I agree with Marvin the Paranoid Android - “How can you live in anything so small?” - I was most taken with its support for ANSI syntax in DML statements. For instance, to update one table with values from another is a simple matter:
Or to delete rows from one table if they don't match rows in another table, use an anti-join:
update t1
set t1.col_a = t1.col_a + t2.col_b
from my_table t1
join some_other_table t2
on ( t1.id = t2.id )
The update is particularly elegant compared to the cumbersome sub-queries Oracle still demands. I think if Oracle had extended its ANSI SQL support beyond SELECT to the other DML commands the argument over whether to use the new syntax would have died out years ago.
delete t1
from target_table t1
left outer join check_table t2
on ( t1.pk_col = t2.pk_col )
where t2.pk_col is null
By: [author-name]
This article was syndicated via RSS from: http://radiofreetooting.blogspot.com/2012/07/oracle-and-ansi-joins.html
