How to use expressions in SQL SELECT Statement?
Expressions combine many arithmetic operators, they can be used in SELECT, WHERE and ORDER BY Clauses of the SQL SELECT Statement. Here we will explain how to use expressions in the SQL SELECT Statement. About using expressions in WHERE and ORDER BY clause, they will be explained in their respective sections. The operators are evaluated in a specific order of precedence, when more than one arithmetic operator is used in an expression. The order of evaluation is: parentheses, division, multiplication, addition, and subtraction. The evaluation is performed from the left to the right of the expression. For example: If we want to display the first and last name of an employee combined together, the SQL Select Statement would be like SELECT first_name || ‘ ‘ || last_name FROM employee; Output: first_name || ‘ ‘ || last_name ——————————— Rahul Sharma Anjali Bhagwat Stephen Fleming Shekar Gowda Priya Chandra You can also provide aliases as below.