When returning the query results , you want to provide an alternate name for the column for readability purpose , you can use the AS clause to specify the column alias in SQL Query.
How to specify Column alias in SQL Query ?
Below is an example of the usage of the column alias in SQL Query.
USE AdventureWorks2014 SELECT Name as 'Depart Name',GroupName as 'Group Name' FROM HumanResources.Department
Every column in the Query result has a column name associated to it and is displayed in the column header. In the above query , the column name is Name and GroupName. An alias name ‘Depart Name’ and ‘Group Name’ is specified for the same in quotes which lets the developer specify the alias name containing spaces.
Leave a Reply