Expression as column in SQL Query

You can write an expression and place it in the SELECT list of a SQL Query.

For example , you want to display the Total Leaves available for the user from the Employee table. Total Leaves in this case can be VacationHours + SickLeaveHours.

Below is the Query include the expression as column and display the results.

SELECT VacationHours + SickLeaveHours AS Leaves 
FROM  HumanResources.Employee; 

Leave a Reply