DB2 Flashcards
Explain Second Normal Form
Non key columns provide a fact about the key.
Explain First Normal form
All occurrences of a record should contain the same number of records.
Explain 3rd normal Form.
Each non key column is independent of other non key columns and is dependant only on the key.
Each non key column must provide a fact about the key.
Explain 4th Normal Form
No row contains 2 or more independent multi-valued facts about an entity.
Explain stage 1 and stage 2 predicates
Stage 1
Sarge able (searchable argument) Uses the data manager (DM)
Stage 2
Non Sargeable , non indexable, uses RDS
SQL - How would you find out the total rows on a DB2 table?
SELECT COUNT(*) WITH UR
Or
Check catalog RTS if re-orged regularly.
SQL - How do you eliminate duplicate values in SQL.
SELECT DISTINCT or preferably, ensure predicate uses full key
SQL - How would you find the highest value for a column?
SELECT MAX(col name)
SQL - How would you select the first five characters of the column FIRSTNAME of Table EMP.
SELECT SUBSTR(FIRSTNAME,1,5) FROM EMP
SQL - How would you concatenate FIRSTNAME and LASTNAME in SQL to give a complete name.
Select Strip(FIRSTNAME) CONCAT “ “ CONCAT strip(LASTNAME) as FULLNAME
SQL - How would you list employees who are not assigned to a project.
SELECT FIRSTNAME
,LASTNAME
FROM. EMP
WHERE PROJECT IS NULL
Explain CS,RR and UR.
Cursor Stability
Locks released on page at once
Repeatable Read
Locks retained until end of transaction
Uncommitted Read
No locks
Describe the physical storage of
DATE
TIME
TIMESTAMP
Physical
DATE 4 Bytes
TIME 3 Bytes
TIMESTAMP 10 Bytes
Layout DATE CHAR(08) TIME CHAR(06) TIMESTAMP CHAR(26)
Name the various locking levels.
Row
Page
Table
Table space
SQL - What would you accomplish with GROUP BY and HAVING.
GROUP BY will display groups of data with their aggregate function result.
HAVING will restrict the result to those that satisfy the HAVING clause.
I.e HAVING count(*) > 1.