What is a subselect? Is it different from a nested select?
A
subselect is a select which works in conjunction with another select. A nested
select is a kind of subselect where the inner select passes to the where
criteria for the outer select.
What
are some SQL aggregates and other built-in functions?
The
common aggregate, built-in functions are AVG, SUM, MIN, MAX, COUNT and
DISTINCT.
How
is the SUBSTR keyword used in SQL?
SUBSTR
is used for string manipulation with column name, first position and string
length used as arguments. E.g.
SUBSTR
(NAME, 1 3) refers to the first three characters in the column NAME.
What is referential integrity?
Referential integrity refers to the consistency that must be maintained between primary and foreign keys, i.e. every foreign key value must have a corresponding primary key value.
What is a NULL value? What are the pros and cons of using NULLS?
A NULL value takes up one byte of storage and indicates that a value is not present as opposed to a space or zero value. It's the DB2 equivalent of TBD on an organizational chart and often correctly portrays a business situation. Unfortunately, it requires extra coding for an application program to handle this situation.
Explain the EXPLAIN statement?
The
explain statement provides information about the optimizer's choice of access
path of the SQL.
What is the difference between group by and order by?
Group by controls the presentation of the rows, order by controls the presentation of the columns for the results of the SELECT statement.
What keyword does an SQL SELECT statement use for a string search?
The LIKE keyword allows for string searches. The % sign is used as a wildcard.
What
is a synonym? How is it used?
A
synonym is used to reference a table or view by another name. The other name can then be written in the
application code pointing to test tables in the development stage and to
production entities when the code is migrated. The synonym is linked to the AUTHID
that created it.
What is an
alias and how does it differ from a synonym?
An
alias is an alternative to a synonym, designed for a distributed environment to
avoid having to use the location qualifier of a table or view. The alias is not dropped when the table is
dropped.