DB2 Realtime (Scenario based) Interview Questions (31 - 40)
31. Suppose a Plan contains 4 Packages & we modified one of the DBRM which is present in one of the Package. Then for normal functionality of application what should we do?
Rebind the modified package and then rebind the plan to ensure the application works with the latest changes.
32. In a COBOL-DB2 program where can we declare a cursor?
In a COBOL-DB2 program, a cursor can be declared in the WORKING-STORAGE SECTION or PROCEDURE DIVISION using embedded SQL.
33. Suppose a table A has an Alias named ATABLE. Which of the query is correct to drop the ATABLE alias?
To drop the alias ATABLE for table A, use: DROP ALIAS ATABLE;
34. How many clustering index we can have for a single table?
Only one clustering index is allowed per table in DB2, as it determines the physical order of rows on disk.
35. Which index must be present for partitioned table space?
A partitioning index (also called a partitioned index) must be present for a partitioned table space.
36. Write the query to delete all the rows from a table.
Use DELETE FROM table_name;
to remove all rows from the table while keeping the table structure intact.
37. Which statement is used to revoke the access from a database?
Use the REVOKE statement to remove access privileges from a user on a database.
38. Which statement is used to authorize access on database tables?
Use the GRANT statement to authorize users to access and perform actions on DB2 tables.
GRANT SELECT, INSERT ON EMPLOYEE TO USER1;
39. In which statement you can define primary key?
You can define a primary key in the CREATE TABLE or ALTER TABLE statement.
CREATE TABLE -
CREATE TABLE EMPLOYEE (
EMP_ID INT NOT NULL,
NAME VARCHAR(50),
PRIMARY KEY (EMP_ID)
);
In ALTER TABLE: -
ALTER TABLE EMPLOYEE
ADD PRIMARY KEY (EMP_ID);
40. How many primary keys can be declared on a table?
A DB2 table can have only one primary key, which may consist of one or multiple columns (composite key).