Monday, January 4, 2010

Day 9



[ Team LiB ]






Day 9


1:

Can you define a primary key column to be nullable? Why or why not?

A1:

Primary keys must not be nullable. There must be a value for each primary key column, and each row must be unique. If the column contained a null value, it would be impossible to reference the row.

2:

What are some differences between the data types VARCHAR and CHARACTER?

A2:

The VARCHAR and CHARACTER data types hold the same types of data, but VARCHAR is more efficient. Suppose that you create two 10-character columns, defining one column as VARCHAR and the other as CHARACTER. Ten bytes are reserved for the CHARACTER column regardless of the data inserted into the column. For the VARCHAR column, only the amount of space required to store the data is used for the column. CHARACTER columns are a fixed-length and can contain up to 254 bytes per column. VARCHAR columns are variable-length and can contain up to 4,000 bytes per column.

3:

What are the rules for naming a database?

A3:

The name you choose for the database must be different from any other database stored on the same drive. The name must contain eight or fewer characters, be one of A�Z, 0�9, @, #, or $, and can't begin with a number. If your database will be used outside North America, do not use special characters in the name to avoid potential code-page problems.

4:

After you create a table, what attributes can change by altering the table?

A4:

After you create a table, the attributes that you can change are limited. You can change the comment, the data capture for propagation option, the lock size, percentage of free space, and other performance-related details.

When altering a table, you may also add new columns and change, remove, or rearrange the new columns; add unique, foreign, and partitioning keys for the table; add or drop columns from the primary keys for the table or change the constraint name; or add, change, or remove new check constraints.

5:

When is data checked to make sure that it complies with rules defined as a check constraint?

A5:

Rules defined as check constraints are checked when data is inserted into the database or when an attempt to update data is made. Constraint checking can be turned off to add foreign keys to your table. After you add the foreign key, you need to turn constraint checking back on.







    [ Team LiB ]



    No comments: