SQL
6. Aliasing - SQL code (open)
◀ ▷ ▶ ♤ ♠ ♡ ♥ ♧ ♣ ⊙e
2022. 11. 19. 05:37
반응형
--Aliasing column name
selectfirstname +' '+LastName as Fullname --alisasing column name
from[SQL Tutorial].dbo.EmployeeDemographics
selectAvg(Age) as AvgAge --aliasing column name
from[SQL Tutorial].dbo.EmployeeDemographics
--Aliasing table name
selectdemo.EmployeeID, Sal.Salary
from[SQL Tutorial].dbo.EmployeeDemographics as Demo --as 생략해도 된다.
join [SQL Tutorial].dbo.EmployeeSalary as Sal
onDemo.EmployeeID =Sal.EmployeeID
--Aliasing table name --as 생략가능
--A,b,c,d,로는 추천안한다. 나중에 뭐가 뭔지 알아보기 어려울수있다.
--Demographic의 demo / Salary의 sal / Warehouse의 ware 같은 식으로 해야 나중에 읽을때 알아보기 편한다.