how to select a random row with DB2:
SELECT column, RAND() as IDX FROM table ORDER BY IDX FETCH FIRST 1 ROWS ONLY
DB2 Functions:
Two types of functions can be applied to data in a DB2 table using SQL:
column functions and scalar functions.
example of Column function:
SELECT SUM(SALARY) FROM EMP WHERE WORKDEPT = 'D21';
example of Scalar function:
SELECT DAYOFWEEK(HIREDATE) FROM EMP WHERE EMPNO = '000100';
SELECT CEILING(3.5), CEILING(3.1), CEILING(-3.1), CEILING(-3.5)
FROM FROM SYSIBM.SYSDUMMY1;
No comments:
Post a Comment