Sunday, November 9, 2008

Natural Joins - Still not in MS SQL Server

One of the coolest join options in Oracle is the Natural Join. Provided that the tables' columns were named such that the column name indicated which columns in two or more tables should be used for a join, it reduced the effort in writing SQL queries.

Instead of writing a:
SELECT ContactName, CityName
FROM Contact
JOIN City ON Contact.CityId = City.CityId
you could simply write:
SELECT ContactName, CityName
FROM Contact
NATURAL JOIN City

Considering how Microsoft has been trying to make development easier for software programmers, this is one feature that they ought to think about.

No comments: