DB2 Database Fundamentals and SQL

Covers DB2 database concepts including SQL functions, transactions, temporary tables, isolation levels, views, joins, schemas, data types, and database administration tasks

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Given the following scenario: Table TABLE1 needs to hold specific numeric values up to 9999999.999 in column COL1. Once TABLE1 is populated, arithmetic operations will be performed on data stored in col-umn COL1. Which of the following would be the most appropriate DB2 data type to use for column COL1?

  1. INTEGER
  2. REAL
  3. NUMERIC (7,3)
  4. DECIMAL(10,3)
Question 2 Multiple Choice (Single Answer)

Which of the following tools can be used to automate table reorganization Operations ?

  1. Control Center
  2. Command Center
  3. Command Line Processor
  4. Task Center
Question 3 Multiple Choice (Single Answer)

How do you find the total number of rows in a table ?

  1. SELECT COUNT *
  2. SELECT COUNT(*)
  3. SELECT COUNT[*]
  4. SELECT COUNT(ALL)
Question 4 Multiple Choice (Single Answer)

Given the following statement: CREATE TABLE t1 col1  SMALLINT NOT NULL PRIMARY KEY, col2  VARCHAR(200) NOT NULL WITH DEFAULT NONE, col3  DECIMAL(5,2) CHECK (col3 >= 100.00), col4  DATE NOT NULL WITH DEFAULT) Which of the following definitions will cause the CREATE TABLE statement to fail?

  1. COL1
  2. COL2
  3. COL3
  4. COL4
Question 5 Multiple Choice (Single Answer)

Which authority or privilege is granted by the DB2 Database Manager configuration file?

  1. CONNECT
  2. CONTROL
  3. SYSMAINT
  4. EXECUTE
Question 6 Multiple Choice (Single Answer)

Which of the following isolation levels will lock all rows scanned to build a result data set?

  1. Uncommitted Read
  2. Cursor Stability
  3. Read Stability
  4. Repeatable Read
Question 7 Multiple Choice (Single Answer)

What is the picture clause of the null indicator variable

  1. S9 (4) COMP-3
  2. S9 (4)
  3. 9 (4)
  4. S9 (4) COMP
Question 8 Multiple Choice (Single Answer)

_____ is dropped when the table or tablespace is dropped

  1. SYNONYM
  2. ALIAS
  3. All of the above
  4. None of the above
Question 9 Multiple Choice (Single Answer)

A collection of named objects is called ______

  1. Schema
  2. Table
  3. Alias
  4. Both a & b
Question 10 Multiple Choice (Single Answer)

The maximum number of tables that can be joined is _____________

  1. 20
  2. 10
  3. 15
  4. No Limit.
Question 11 Multiple Choice (Single Answer)

Given the following table: TEMP_DATA TEMP DATE _____________ 45    12/25/2006 51    12/26/2006 67    12/27/2006 72    12/28/2006 34    12/29/2006 42    12/30/2006 And the following SQL statement: TE FUNCTION degf_to_c (temp INTEGER) RETURNS INTEGER LANGUAGE SQL CONTAINS SQL NO EXTERNAL ACTION DETERMINISTIC BEGIN ATOMIC DECLARE newtemp INTEGER; SET newtemp = temp - 32; SET newtemp = newtemp * 5; RETURN newtemp / 9; END Which two of the following SQL statements illustrate the proper way to invoke the calar function DEGF_TO_C?

  1. VALUES degf_to_c(32)
  2. SELECT date, degf_to_c(temp) AS temp_c FROM temp_data
  3. CALL degf_to_c(32)
  4. Both a and b
Question 12 Multiple Choice (Single Answer)

Which wildcard character is used for a single character replacement

  1. %
  2. &
  3. _
  4. None of the above
Question 13 Multiple Choice (Single Answer)

To retrieve data from more than one table we could use

  1. Joins
  2. Unions
  3. Nested SELECT
  4. All of the above
Question 14 Multiple Choice (Single Answer)

What is the restriction on using UNION in embedded SQL ?

  1. It has to be in a CURSOR
  2. cannot be used in Embedded SQL
  3. No restrictions
  4. None of the above
Question 15 Multiple Choice (Single Answer)

Which of the following is a NOT a valid reason for defining a view on a table?

  1. Restrict users' access to a subset of table data
  2. Ensure that rows inserted remain within the scope of a definition
  3. Produce an action as a result of a change to a table
  4. Provide users with an alternate view of table data
Question 16 Multiple Choice (Single Answer)

Which of the following isolation levels will lock all rows scanned to build a result data set?

  1. Uncommitted Read
  2. Cursor Stability
  3. Read Stability
  4. Repeatable Read
Question 17 Multiple Choice (Single Answer)

A declared temporary table is used for which of the following purposes?

  1. Backup purposes
  2. Storing intermediate results
  3. Staging area for load operations
  4. Sharing result data sets between applications
Question 18 True/False

The identity value will be rolled back when the transaction that tried to insert the value into the table is not committed or rolled back

  1. True
  2. False
Question 19 True/False

We can declare DB2 host variables in a COBOL copybook

  1. True
  2. False
Question 20 Multiple Choice (Single Answer)

Given the following table: TEMP_DATA TEMP DATE _____________ 45    12/25/2006 51    12/26/2006 67    12/27/2006 72    12/28/2006 34    12/29/2006 42    12/30/2006 And the following SQL statement: TE FUNCTION degf_to_c (temp INTEGER) RETURNS INTEGER LANGUAGE SQL CONTAINS SQL NO EXTERNAL ACTION DETERMINISTIC BEGIN ATOMIC DECLARE newtemp INTEGER; SET newtemp = temp - 32; SET newtemp = newtemp * 5; RETURN newtemp / 9; END Which two of the following SQL statements illustrate the proper way to invoke the calar function DEGF_TO_C?

  1. VALUES degf_to_c(32)
  2. SELECT date, degf_to_c(temp) AS temp_c FROM temp_data
  3. CALL degf_to_c(32)
  4. Both a and b