IBM DB2 Interview Questions and Answers
Intermediate / 1 to 5 years experienced level questions & answers
Ques 1. Explain the difference between DB2 and other relational databases.
DB2 is known for its advanced features like pureXML, Time Travel Query, and deep compression, setting it apart from other relational databases.
Ques 2. What is a clustered index in DB2?
A clustered index determines the physical order of data in a table. In DB2, it is implemented using the CLUSTERED keyword during table creation.
Ques 3. What is the difference between a primary key and a unique key in DB2?
Both primary and unique keys enforce the uniqueness of values, but a table can have only one primary key, while it can have multiple unique keys.
Ques 4. What is a cursor in DB2?
A cursor is a database object that allows for both fetching and updating rows from a result set one at a time.
Ques 5. Explain the purpose of the RUNSTATS command in DB2.
The RUNSTATS command is used to collect statistics about the data in tables and indexes, helping the query optimizer to generate efficient query plans.
Ques 6. Explain the ACID properties in the context of DB2.
ACID stands for Atomicity, Consistency, Isolation, and Durability. These properties ensure the reliability of database transactions.
Ques 7. What is a buffer pool in DB2?
A buffer pool is a memory area used to cache table and index data to reduce the I/O operations and improve query performance.
Ques 8. What is the purpose of the LOAD utility in DB2?
The LOAD utility is used to efficiently load large amounts of data into DB2 tables. It is faster than using SQL INSERT statements for bulk data loading.
Ques 9. Explain the difference between a view and a materialized query table (MQT) in DB2.
A view is a virtual table based on the result of a SELECT query, while an MQT is a physical table that stores the result of a query, and its data is updated periodically.
Ques 10. What is a DB2 package?
A DB2 package is a compiled set of SQL statements and procedures stored in the database. It can be executed by database applications.
Ques 11. Explain the purpose of the REORG utility in DB2.
The REORG utility is used to reorganize the physical storage of tables and indexes, optimizing space usage and improving query performance.
Ques 12. What is the purpose of the RUNTIMESTATS option in DB2?
The RUNTIMESTATS option is used to collect runtime statistics for SQL statements, providing information about resource usage during query execution.
Ques 13. Explain the role of the db2ckpwd utility in DB2.
The db2ckpwd utility checks the strength of user passwords in DB2, helping to enforce security policies and prevent weak passwords.
Ques 14. What is a correlated subquery in DB2?
A correlated subquery is a subquery that refers to columns from the outer query. It is executed once for each row processed by the outer query.
Ques 15. Explain the purpose of the EXPORT and IMPORT utilities in DB2.
The EXPORT utility is used to export data from DB2 tables, while the IMPORT utility is used to import data into DB2 tables. They are often used for data migration and backups.
Ques 16. What is a package bind in DB2?
A package bind is the process of associating a package, which contains the compiled form of SQL statements, with a database. It is a crucial step in executing SQL statements.
Ques 17. Explain the purpose of the LOAD RESUME option in the LOAD utility.
The LOAD RESUME option allows the loading of data to resume from the point of failure in case of a previous load failure, reducing the need to reload all data.
Ques 18. What is the purpose of the db2move command in DB2?
The db2move command is used for copying or moving data between databases. It is particularly useful for exporting and importing data in a structured manner.
Ques 19. Explain the concept of table space in DB2.
A table space is a container for database objects such as tables, indexes, and long field columns. It provides a logical grouping of related objects for storage management.
Ques 20. What is a correlated scalar subquery in DB2?
A correlated scalar subquery is a subquery that returns a single value and is evaluated once for each row processed by the outer query, using values from that row.
Ques 21. Explain the purpose of the db2pd command in DB2.
The db2pd command is used to display information about various aspects of the DB2 instance, such as memory usage, locks, and active applications.
Ques 22. Explain the purpose of the REBIND command in DB2.
The REBIND command is used to rebind packages in DB2, refreshing the access plan and optimizing the SQL statements after changes to the database or its statistics.
Ques 23. What is the purpose of the db2exfmt command in DB2?
The db2exfmt command is used to format the output of the EXPLAIN statement, providing a more readable and understandable representation of the access plan.
Ques 24. Explain the purpose of the db2look command in DB2.
The db2look command is used to generate SQL statements that can recreate the structure and data of a database, including tables, indexes, and constraints.
Most helpful rated by users: