Sunteți pe pagina 1din 4

DB2

Q1. What is a DB2 bind?


A1. A DB2 bind is a process that builds an access path to DB2 tables.
Q2. What is a DB2 access path?
A2. An access path is the method used to access data specified in DB2 sql statements.
Q3. What is a DB2 plan?
A3. An application plan or package is generated by the bind to define an access path.
Q4. What is normalization and what are the five normal forms?
A4. Normalization is a design procedure for representing data in tabular format. The fie
normal forms are progressie rules to represent the data with minimal redundancy.
Q5. What are foreign keys?
A5. These are attributes of one table that hae matching alues in a primary key in
another table! allowing for relationships between tables.
Q. Describe the elements of the "#$#%T query synta&.
A. "#$#%T element '()* table W+#(# conditional statement.
Q!. #&plain the use of the W+#(# clause.
A!. W+#(# is used with a relational statement to isolate the ob,ect element or row.
Q". What techniques are used to retriee data from more than one table in a single "-$
statement?
A". #oins$ %nions and nested selects are used to retriee data.
Q&. What do the initials DD$ and D*$ stand for and what is their meaning?
A&. DD$ is data definition language and D*$ is data manipulation language. DD$
statements are %(#AT#! A$T#(! T(./%AT#. D*$ statements are "#$#%T! 0/"#(T!
D#$#T# and .1DAT#.
Q1'. What is a vie(? Why use it?
A1'. A iew is a irtual table made up of data from base tables and other iews! but not
stored separately.
Q11. #&plain an o%ter )oin.
A11. An outer ,oin includes rows from tables when there are no matching alues in the
tables.
Q12. What is a s%bselect? 0s it different from a nested select?
A12. A s%bselect is a select which works in con,unction with another select. A nested
select is a kind of subselect where the inner select passes to the where criteria for the
outer select.
Q13. What is the difference between gro%p by and order by?
DB2-FAQ 1
A13. *ro%p by controls the presentation of the rows! order by controls the presentation
of the columns for the results of the "#$#%T statement.
Q14. #&plain the #21$A0/ statement.
A14. The e&plain statement proides information about the optimi3er4s choice of access
path of the sql.
Q15. What is tablespace?
A15. Tables are stored in tablespaces 5hence the name67 There are three types of
tablespaces8 simple! segmented and partitioned.
Q1. What is a c%rsor and what is its function?
A1. An embedded sql statement may return a number of rows while the programming
language can only access one row at a time. The programming deice called a c%rsor
controls the position of the row.
Q1!. What is referential integrity?
A1!. +eferential integrity refers to the consistency that must be maintained between
primary and foreign keys! ie eery foreign key alue must hae a corresponding primary
key alue.
Q1". .sually! which is more important for DB2 system performance 9 %1. processing or
0:) access?
A1". 0:) operations are usually most critical for DB2 performance 5or any other database
for that matter6.
Q1&. 0s there any adantage to denormalizing DB2 tables?
A1&. ,enormalizing DB2 tables reduces the need for processing intensie relational ,oins
and reduces the number of foreign keys.
Q2'. What is the database descriptor?
A2'. The database descriptor! ,-, is the DB2 component that limits access to the
database wheneer ob,ects are created! altered or dropped.
Q21. What is lock contention?
A21. To maintain the integrity of DB2 ob,ects the DBD permits access to only on ob,ect
at a time. .ock contention happens if seeral ob,ects are required by contending
application processes simultaneously.
Q22. What is /01234
A22. /0123 stands for "-$ processing using file input. 0t is the DB2 interactie menu9
drien tool used by deelopers to create database ob,ects.
Q23. What is the significance of DB2 free space and what parameters control it?
A23. The two parameters used in the %(#AT# statement are the 0562+77 which
specifies the percentage of free space for each page and 2+770A*7 which indicates the
number of pages to be loaded with data between each free page. 'ree space allows room
for the insertion of new rows.
DB2-FAQ 2
Q24. What is a N1.. alue? What are the pros and cons of using /.$$"?
A24. A N1.. alue takes up one byte of storage and indicates that a alue is not present
as opposed to a space or 3ero alue. 0t4s the DB2 equialent of TBD on an organi3ational
chart and often correctly portrays a business situation. .nfortunately! it requires e&tra
coding for an application program to handle this situation.
Q25. What is a synonym? +ow is it used?
A25. A synonym is used to reference a table or iew by another name. The other name
can then be written in the application code pointing to test tables in the deelopment stage
and to production entities when the code is migrated. The synonym is linked to the
A.T+0D that created it.
Q2. What is an alias and how does it differ from a synonym?
A2. An alias is an alternatie to a synonym! designed for a distributed enironment to
aoid haing to use the location qualifier of a table or iew. The alias is not dropped when
the table is dropped.
Q2!. What is a $0;# table and how is it created?
A2!. A $0;# table is created by using the $0;# parameter in a %(#AT# table statement.
$0;# tables are typically created for a test enironment from the production enironment.
Q2". 0f the base table underlying a iew is restructured! eg. attributes are added! does the
application code accessing the iew need to be redone?
A2". /o. The table and its iew are created anew! but the programs accessing the iew do
not need to be changed if the iew and attributes accessed remain the same.
Q2&. .nder what circumstances will DB2 allow an "-$ statement to update more than
one primary key alue at a time?
A2&. /eer. "uch processing could produce duplicate alues iolating entity integrity.
1rimary keys must be updated one at a time.
Q3'. What is the cascade r%le and how does it relate to deletions made with a subselect.
A3'. The cascade r%le will not allow deletions based on a subselect that references the
same table from which the deletions are being made.
Q31. What is the self8referencing constraint?
A31. The self8referencing constraint limits in a single table the changes to a primary key
that the related foreign key defines. The foreign key in a self referencing table must specify
the D#$#T# %A"%AD# rule.
Q32. What are delete8connected tables?
A32. Tables related with a foreign key are called delete8connected because a deletion in
the primary key table can affect the contents of the foreign key table.
Q33. When can an insert of a new primary key alue threaten referential integrity?
A33. /eer. /ew primary key alues are not a problem. +oweer! the alues of foreign
key inserts must hae corresponding primary key alues in their related tables. And
DB2-FAQ 3
updates of primary key alues may require changes in foreign key alues to maintain
referential integrity.
Q34. 0n terms of DB2 inde&ing! what is the root page?
A34. The simplest DB2 inde& is the -8tree and the B9tree4s top page is called the root
page. The root page entries represent the upper range limits of the inde& and are
referenced first in a search.
Q35. +ow does Db2 use m%ltiple table inde9es?
A35. DB2 use the m%ltiple inde9es to satisfy multiple predicates in a "#$#%T statement
that are ,oined by an A/D or )(.
Q3. What are some characteristics of columns that benefit from inde&es?
A3. 0rimary key and foreign key columns< columns that hae unique alues< columns
that hae aggregates computed frequently and columns used to test the e&istence of a
alue.
Q3!. What is a composite inde9 and how does it differ from a m%ltiple inde9?
A3!. A m%ltiple inde9 is not one inde& but two inde&es for two different columns of a
table. A composite inde9 is one inde& made up of combined alues from two columns in a
table. 0f two columns in a table will often be accessed together a composite inde9 will be
efficient.
Q3". What is meant by inde9 cardinality?
A3". The number of distinct alues for a column is called inde9 cardinality. DB24s
(./"TAT" utility analy3es column alue redundancy to determine whether to use a
tablespace or inde& scan to search for data.
Q3&. What is a cl%stered inde9?
A3&. 'or a cl%stered inde9 DB2 maintains rows in the same sequence as the columns in
the inde& for as long as there is free space. DB2 can then process that table in that order
efficiently.
Q4'. What keyword does an "-$ "#$#%T statement use for a string search?
A4'. The $0;# keyword allows for string searches. The = sign is used as a wildcard.
Q41. What are some sql aggregates and other b%ilt8in f%nctions?
A41. The common aggregate$ b%ilt8in f%nctions are A>?! ".*! *0/! *A2! %)./T
and D0"T0/%T.
Q42. +ow is the ".B"T( keyword used in sql?
A42. ".B"T( is used for string manipulation with column name! first position and string
length used as arguments. #g. ".B"T( 5/A*#! @ A6 refers to the first three characters in
the column /A*#.
Q43. What are the three DB2 date and time data types and their associated functions?
A43. The three data types are
DB2-FAQ 4

S-ar putea să vă placă și