5) How do you retrieve the first 5 characters of FIRSTNAME column of DB2 table EMP
?
SQL Query : SELECT SUBSTR(FIRSTNAME,1,5) FROM EMP;
6) What are aggregate functions?
Bulit-in mathematical functions for use in SELECT clause.
7) Can you use MAX on a CHAR column?
YES.
8) My SQL statement SELECT AVG(SALARY) FROM EMP yields inaccurate results.
Why?
Because SALARY is not declared to have NULLs and the employees for whom the
salary is not known are also counted.
9) How do you concatenate the FIRSTNAME and LASTNAME from EMP table to give a
complete name?
SELECT FIRSTNAME || ‘ ‘ || LASTNAME FROM EMP;
10) What is the use of VALUE function?
1. Avoid -ve SQLCODEs by handling nulls and zeroes in computations
2. Substitute a numeric value for any nulls used in computation
|