What happened to the *= and =* for outer joins in SQL?
Pergunta
I was just curious as to why the *=
operator for left outer join
and the '=*' for 'right outer join were taken out of the SQL standard, or, at least not supported by SQL server 2005 and on? I have read a few other posts on this particular operator and understand that it can give some unexpected results. But if it were semantically equivalent I would think it would be an easier operator to use when having to join multiple tables. If anything, I would rather use this operator to to dynamically create sql queries as opposed to trying to get the correct word order like:
FROM accounts
LEFT OUTER JOIN customers
ON accounts.accountnum = customers.accountnum
LEFT OUTER JOIN products
ON customers.accountnum = products.accountnum
AND customers.id = products.customerid
where
FROM accounts, customers, products
WHERE accounts.accountnum *= customers.accountnum AND
customers.accountnum *= products.accountnum AND
customers.id *= products.customer.id
would seem to be easier to parse together.
But back to the real world, what was the idea for these operators if they dont perfom a "true" outer join? The term Short Hand implies that it should do exactly the same thing, but obviosly not in this case.
Solução
SQL Server MVP K. Brian Kelley does a good job of explaining it here: Why SQL Server 2005 Doesn't Permit Non-ANSI Style OUTER JOINs
Outras dicas
I don't think they were taken out of the standard. I think they were never in it. They were just a convention that vendors followed until SQL-92 came out and the vendors decided it was worth implementing.
Do a google search for the Chris Date paper, "Outer Join with No Nulls and Fewer Tears", which pre-dates the SQL-92 Standard. Although I couldn't find a free copy online, I did find a document that analyses the paper and gives a nice potted history of outer join in SQL. Note nowadays Date would relation-valued attributes for this kind of query and would urge you to generally avoid outer joins ;)