Isnull function
Any arthimetic operation with null results in null. Hence whenever you have to perform arithmetic operations on a column containing null use the function “ISNull”
DEPT TABLE
EMP TABLE
EMP TABLE
Display empno,ename, sal, comm along with total and annual salary
select empno,ename,sal,comm ,sal+isnull(comm,0),(sal+isnull(comm,0))*12 from emp
OR BY USING COL ALIAS
select empno,ename,sal,comm ,sal+isnull(comm,0) AS "TOTAL SALARY",(sal+isnull(comm,0))*12 AS "ANNUAL SALARY"from emp
No comments:
Post a Comment
Thank you for visiting my blog