HOME JCL COBOL DB2 VSAM CICS


DB2 Interview Questions

1. How to find the number of rows in a DB2 table?
To find the number of rows in a DB2 table, the user has to use SELECT COUNT (*) on the DB2 query

2. How can the duplicate values be eliminated from DB2 SELECT?
To eliminate the duplicate values from DB2 SELECT, the user has to use SELECT DISTINCT in the DB2 query.

3. What is Aggregate fucntion?
‘Aggregate’ functions are built-in mathematical tools that are used in the DB2 SELECT clause.

4. Is it possible using MAX on a CHAR column?
Yes! It is possible using MAX on a CHAR column.

5. Why SELECT is not preferred in Embedded SQL programs?
SELECT is not preferred in Embedded SQL programs for three reasons. First, if the table structure is changed by the addition or deletion of a field and the program is modified, then using SELECT might retrieve the columns that the user may not use. This would lead to Input-Output overhead and the chances of index-only scan are also eliminated.

6. When is the LIKE statement used?
The LIKE statement is used to conduct partial searches such as the search of employees by name. It is not necessary to indicate the complete name, partial string matches would do.

7. How is the value function used?
We can perform two tasks using the ‘value’ function:First, to avoid -ve SQLCODEs by handling NULLs and 0s in the computation. Second, to substitute numeric values for NULLs used in the computation

8. What are UNION and UNION ALL?
Both UNION and UNION ALL are used to combine the results generated by multiple SELECT statements. UNION is the function that eliminates duplicates in the table. UNION ALL retains the duplicates

9. Is there any restriction on the use of UNION in Embedded SQL?
While using UNION in Embedded SQL, it has to be in a CURSOR.

10. What do you mean by BETWEEN and IN? Is BETWEEN inclusive of specified range values?
BETWEEN would supply a range of values, whereas IN would provide a list of values. BETWEEN is always inclusive of the range values specified.

1 2 3 4 5
Copyright 2020 by ibmmainframer. All Rights Reserved.