How do you retrieve the first 5 characters of FIRSTNAME column of DB2 table EMP ?

SQL Query : SELECT SUBSTR(FIRSTNAME,1,5) FROM EMP;

 

 What are aggregate functions?

Bulit-in mathematical functions for use in SELECT clause.

 

 Can you use MAX on a CHAR column?

YES.

 

 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.

 

 How do you concatenate the FIRSTNAME and LASTNAME from EMP table to give a complete name?

SELECT FIRSTNAME || ‘ ‘ || LASTNAME FROM EMP;

Advertisements