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
Questions
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?
- INTEGER
- REAL
- NUMERIC (7,3)
- DECIMAL(10,3)
Which of the following tools can be used to automate table reorganization Operations ?
- Control Center
- Command Center
- Command Line Processor
- Task Center
How do you find the total number of rows in a table ?
- SELECT COUNT *
- SELECT COUNT(*)
- SELECT COUNT[*]
- SELECT COUNT(ALL)
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?
- COL1
- COL2
- COL3
- COL4
Which authority or privilege is granted by the DB2 Database Manager configuration file?
- CONNECT
- CONTROL
- SYSMAINT
- EXECUTE
Which of the following isolation levels will lock all rows scanned to build a result data set?
- Uncommitted Read
- Cursor Stability
- Read Stability
- Repeatable Read
What is the picture clause of the null indicator variable
- S9 (4) COMP-3
- S9 (4)
- 9 (4)
- S9 (4) COMP
_____ is dropped when the table or tablespace is dropped
- SYNONYM
- ALIAS
- All of the above
- None of the above
A collection of named objects is called ______
- Schema
- Table
- Alias
- Both a & b
The maximum number of tables that can be joined is _____________
- 20
- 10
- 15
- No Limit.
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?
- VALUES degf_to_c(32)
- SELECT date, degf_to_c(temp) AS temp_c FROM temp_data
- CALL degf_to_c(32)
- Both a and b
Which wildcard character is used for a single character replacement
- %
- &
- _
- None of the above
To retrieve data from more than one table we could use
- Joins
- Unions
- Nested SELECT
- All of the above
What is the restriction on using UNION in embedded SQL ?
- It has to be in a CURSOR
- cannot be used in Embedded SQL
- No restrictions
- None of the above
Which of the following is a NOT a valid reason for defining a view on a table?
- Restrict users' access to a subset of table data
- Ensure that rows inserted remain within the scope of a definition
- Produce an action as a result of a change to a table
- Provide users with an alternate view of table data
Which of the following isolation levels will lock all rows scanned to build a result data set?
- Uncommitted Read
- Cursor Stability
- Read Stability
- Repeatable Read
A declared temporary table is used for which of the following purposes?
- Backup purposes
- Storing intermediate results
- Staging area for load operations
- Sharing result data sets between applications
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
- True
- False
We can declare DB2 host variables in a COBOL copybook
- True
- False
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?
- VALUES degf_to_c(32)
- SELECT date, degf_to_c(temp) AS temp_c FROM temp_data
- CALL degf_to_c(32)
- Both a and b