[ciapug] SQL wiz?

David Champion ciapug@cialug.org
Tue, 15 Feb 2005 15:26:03 -0600


Claus wrote:

> select a.id,
>        a.name,
>        b.grade
> from   table_a a
>        left join table_b b on (a.id = b.id)
> order by a.id

This is nitpicky... but IMHO using one letter aliases reduces 
readability, exactly like one letter variables. Why not just use 
reasonable table names in the first place?

I realize this is a ficticious example, but I see people doing it all 
the time... but their table names are crazy Java coder names like 
"tblMyTableofAccountingDataDetailRecords" when "AcctDetail" would have 
done just as well.

When you have a big multi-join SQL with 4 or 5 tables involved, and you 
start aliasing things to a b c d, it gets really hard to read.

-dc