SQL Single ROW Functions Examples

Here are some examples of SQL single row functions:

SELECT DNAME,SUBSTR(DNAME,1,4) FROM DEPT; ——————————————-
SELECT ENAME, LENGTH(ENAME), JOB, LENGTH(JOB) FROM
EMP;
SELECT COMM, VALUE(COMM, 0) FROM EMP;
———————————————-
SELECT HIREDATE, DAY(HIREDATE), MONTH(HIREDATE),
YEAR(HIREDATE) FROM EMP WHERE YEAR(HIREDATE) > 1988 ———————————————-
SELECT HIREDATE, DAYS(HIREDATE), ‘DAYS DIFFERENCE FROM 0001-01-01’
FROM EMP;
——————————————–
SELECT CURRENT DATE FROM SYSIBM.SYSDUMMY1; ———————————————
SELECT FLOOR(15.7) “FLOOR” FROM SYSIBM.SYSDUMMY1;
——————————————-
SELECT ABS(-15) “ABSOLUTE” FROM SYSIBM.SYSDUMMY1;
————————–
SELECT POWER (3,2) RAISED FROM SYSIBM.SYSDUMMY1; ;
——————————————-
SELECT ROUND(17.175,-1) “NUMBER” FROM SYSIBM.SYSDUMMY1; ;
———————————————
SELECT TRUNC(15.81,1) “NUMBER” FROM SYSIBM.SYSDUMMY1; ;
——————————————

If you find mistake in any of these queries do let us know by commenting.

Add Comment