Omitting the table alias does make an ambiguous reference to the column. Just do join
a left join
and you will immediately see why:
select * from customer c left join order o on c.customerid = o.customerid where customerid = 100
Another reason: one column may be of type INTEGER
, the other type is SMALLINT
. Which one to use for the filter? (This may have implications for the implementation plan). Martin Smith gives an even better example.
So, in general, you would not win by making SQL more "forgiving" while introducing new sources of errors. What you can do with some databases (and not with SQL Server), however this is:
select * from customer c join order o using (customerid) where customerid = 100
Or this (if clientid is the only common column name)
select * from customer c natural join order o where customerid = 100
source share