Thursday, February 4, 2010

Day 2



[ Team LiB ]






Day 2


1:

What's the advantage of using a view?

A1:

By using views, you can set up different presentations of the same data. Each view is derived from the actual table data, but each user will see a subset of the data. The main benefit to using views is that they allow you to control the access your users have to restricted data.

2:

Give some reasons why you would want to define a primary key for a table.

A2:

Defining a primary key on a table allows you to guarantee that each row in the table is unique. Defining a primary key can improve performance as well, because table access is quicker if each row is uniquely identified. If you're using an ODBC application to update your data, you need to have a primary key defined for the table. An index created automatically for the primary key helps DB2 find an efficient path to the data.

3:

What is the difference between unique keys and primary keys?

A3:

Unique keys are optional; no two of its values are the same or null. This constraint is enforced by the database manager when data is inserted or updated. A table can have multiple unique keys. Unique keys are defined when the table is created or altered.

A primary key is a special kind of unique key that uniquely identifies a row of a table. The columns of a primary key can't contain null values. A table can have only one primary key.

4:

What's an instance? What's the advantage of using an instance?

A4:

An instance is a logical database manager environment. Having an instance allows you to catalog databases and set specific configuration parameters to the environment. For example, you can set up a test environment and a production environment by creating two instances. You can change the catalog information and the configuration parameters in the test instance without affecting the data in the production instance. Using instances can also help you protect access to sensitive information, because each instance has a separate assignment of authorized users.

5:

What's the difference between static and dynamic SQL?

A5:

When you write a SQL statement for an application program and know the entire statement, including the SQL statement type (UPDATE, INSERT, and so on) and the table and column names that the statement acts on, you're using static SQL. Static SQL is a SQL statement that's fully written in an application program before the program is compiled. Dynamic SQL is a statement that the application builds and executes at runtime. Generally dynamic SQL is used in an interactive program where the user is prompted for key parts of the SQL statement.







    [ Team LiB ]



    No comments: