Prev | Current Page 403 | Next

Carl Reynolds and Paul Tymann

"Schaum's Outline of Principles of Computer Science"


The most common attributes one specifies for columns are NOT NULL, DEFAULT, and CONSTRAINT.
The NOT NULL attribute requires a value for that column for every row that one adds to the table. By default,
a column may contain a null value.
The DEFAULT attribute allows one to provide an expression that will create a value for a column, if a value
is not otherwise provided when one inserts a new row. For instance, the following column declaration specifies
the default value for the state column to be ???NY???:
State Char(2) DEFAULT 'NY',
148 DATABASE [CHAP. 8
There are four constraints that can be specified: PRIMARY KEY, FOREIGN KEY, UNIQUE and CHECK.
The primary key constraint identifies the column or columns that comprise the primary key.
A foreign key constraint identifies a column that contains values of a primary key in a different table.
Foreign keys are the mechanism for creating relationships among rows (entities) in different tables.
A unique constraint requires all rows in the table to have unique values for the column or set of columns
specified in the constraint. A unique constraint is sometimes called a candidate key, because the unique
column(s) could be used as a primary key for the table, in place of the chosen primary key.


Pages:
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
drukarki fiskalne kraków willa karmazyn międzyzdroje www.books61.hobbitstory.com terapia magnetyczna Informacje o hostingu