SQLTeam.com | Weblogs | Forums

New, trying to understand code

Hello, Im very new to SQL, as in today! I have some SQL and it is running on our DB but Im trying to understand what it is doing. Can you tell me what a11 and a13 indicate in the code below?

select a13.RegionDesc, count(a11.dimacctsk)
from dl_ala_v.xbi_fctcpeinvn a11
join dl_ala_v.xbi_DimOrgKMA a13

Thanks

Those are alias names for the tables. That is, they assign a new name that will be used to reference the columns inside tables instead of the original table.

Without the alias, instead of:

a13.RegionDesc

you'd have to write:

dl_ala_v.xbi_DimOrgKMA.RegionDesc

Oh, thank you!