Scenario: A DBA is tasked with removing outdated records from a database table. Which SQL command should they utilize for this task?
- DELETE
- DROP
- TRUNCATE
- REMOVE
The correct option is 'DELETE'. This SQL command is used to remove one or more rows from a table based on the condition specified in the WHERE clause. It allows the DBA to selectively remove outdated records while retaining the structure of the table and other existing data.
How does DB2 integrate with cloud platforms like AWS and Azure?
- Establishing secure connections to DB2 instances hosted on cloud platforms
- Implementing DB2-compatible services on cloud platforms
- Provisioning virtual instances of DB2 on cloud platforms
- Utilizing managed database services provided by cloud platforms
DB2 integrates with cloud platforms like AWS and Azure by leveraging managed database services provided by these platforms. These services offer features such as automated backups, scaling, and high availability, making it easier to deploy and manage DB2 databases in the cloud.
Scenario: A company's DB2 database experiences a critical failure, and the primary server becomes unavailable. How can the company ensure minimal downtime and data loss?
- Implementing a high availability solution with automatic failover to a standby server
- Increasing backup frequency to hourly to minimize data loss
- Moving all data to a cloud-based storage solution
- Shutting down all database operations until the primary server is restored
In the event of a critical failure, implementing a high availability solution with automatic failover to a standby server is crucial to minimize downtime and data loss. This involves configuring DB2 for automatic client reroute and using tools like HADR (High Availability Disaster Recovery) to ensure seamless failover to the standby server. This approach ensures that database operations can continue with minimal interruption.
Scenario: A data analyst wants to add new data to an existing database table. Which SQL statement should they execute?
- INSERT INTO
- UPDATE
- ADD
- MODIFY
The correct option is 'INSERT INTO'. This SQL statement is used to add new rows of data into an existing database table. It allows the data analyst to insert specific values into specified columns or insert values from a SELECT statement into the table.
The notation of a dotted line connecting entities in an ERD indicates a ________ relationship.
- Mandatory
- Many-to-Many
- One-to-Many
- One-to-One
A dotted line connecting entities in an ERD typically represents a one-to-many relationship. This means that one instance of an entity can be associated with multiple instances of another entity, but each instance of the second entity can be associated with only one instance of the first entity.
What does the Reorg utility do to database objects in DB2?
- Creates new tables
- Deletes obsolete rows
- Reorganizes data and indexes
- Updates table statistics
The Reorg utility in DB2 reorganizes both data and indexes in database objects. It rearranges the physical storage of data, eliminating fragmentation and reclaiming space, which helps in improving performance. Additionally, it also updates statistics for these objects. It does not create new tables or delete obsolete rows.
In DB2, a UNIQUE constraint ensures that ________.
- Data types are consistent across tables.
- Each value in a column or set of columns is unique.
- Null values are allowed in specified columns.
- The table has a primary key constraint.
The UNIQUE constraint in DB2 ensures that each value in a specified column or set of columns is unique across all the rows in the table. It prevents duplicate values from being entered into the table.
How does the SUM() function behave when applied to a column with NULL values in DB2?
- It ignores NULL values
- It replaces NULL with 0
- It returns NULL
- It throws an error
The SUM() function in DB2 behaves by ignoring NULL values when applied to a column. It calculates the sum of all non-null values in the specified column. This behavior is important to understand when dealing with numerical data in DB2 queries, as it ensures that NULL values do not affect the calculation of sums.
To verify a successful installation, you can check for the presence of ________.
- db2.exe
- db2start
- db2ls
- db2level
The correct answer is option D. You can verify a successful installation of DB2 by checking the presence of the db2level command. This command displays the DB2 product level and fix pack information, confirming a successful installation.
In an ERD, what does a diamond-shaped component represent?
- Attributes
- Foreign Keys
- Primary Keys
- Relationships
In an Entity-Relationship Diagram (ERD), a diamond-shaped component represents relationships between entities. It signifies how entities are related to each other, whether it's a one-to-one, one-to-many, or many-to-many relationship.
In DB2, what is the significance of primary keys in tables?
- They allow NULL values in the column
- They automatically create indexes
- They define the order of the rows
- They ensure uniqueness of each row
Primary keys in DB2 tables play a crucial role in ensuring the uniqueness of each row. They enforce entity integrity by ensuring that no two rows have the same values in the specified column or combination of columns. This uniqueness constraint helps maintain data accuracy and consistency.
What are weak entities in an ERD?
- Entities with composite attributes
- Entities with derived attributes
- Entities with strong relationships
- Entities without primary keys
Weak entities are entities that do not have a primary key attribute on their own. They rely on a relationship with another entity (owner entity) for their existence.