Correct Answer: Use SELECT DISTINCT in DB2 query The DISTINCT keyword can be used to return only distinct (different) values Syntax: SELECT DISTINCT column1,column2 FROM table_name;
Correct Answer: Both these are used to combine the results of different SELECT statements UNION - Selects only distinct values UNION ALL - Selects duplicate values also Syntax: SELECT column_name(s) FROM table1 UNION / UNION ALL SELECT column_name(s) FROM table2; Notice that each SELECT statement within the UNION must have the same number of columns The columns must also have similar data types Also, the columns in each SELECT statement must be in the same order
3. What is a cursor ? Why should it be used in DB2?
Correct Answer: Cursor is a programming device that allows the SELECT to find a set of rows but return them one at a time Cursor should be used because the host language can deal with only one row at a time
Correct Answer: 1 Based on the lock-size given while creating the table space 2 Programer can direct the DB2 what lock-size to use 3 If lock - size ANY is specified, DB2 usually chooses a lock-size of PAGE
Correct Answer: A DB2 utility used to collect statistics about the data values in tables which can be used by the optimizer to decide the access path It also collects statistics used for space management These statistics are stored in DB2 catalog tables
8. How do you insert a record with a nullable column?
Correct Answer: REORG reorganizes data on physical storage to reclutser rows, positioning overflowed rows in their proper sequence, to reclaim space, to restore free space It is used after heavy updates, inserts and delete activity and after segments of a segmented tablespace have become fragmented