Friday, April 6, 2012

RETATIONAL MODEL

The Relational Model was developed by E. F. Codd in 1969. This model was created based on the concepts of Set theory of Mathematics. The purpose of creating this model was to rearrange the unordered data of a table in an ordered form by creating relations between tables. When a database is designed based on the Relational Model, it is called Relational database. There are many advantages of the relational database, some of which are as follows:
  1. Creating a data report becomes easy as the data it consists of is in the ordered form
  2. User entry becomes easier as it restricts the entry of illegal data
  3. Updation and deletion can be restricted as the model follows some integrity rules
  4. Changes can easily be made in a database schema
  5. Retrieving and summarizing the data becomes easier
Integrity Rules 
There are certain keys defined in Oracle 11g to follow the integrity rules. These are called constraints. Integrity rules bind a database with different constraints. According to the Relational Model, single row of a table should be unique; otherwise, it will violate the rule. For example, they do not let a duplicate record enter in a table. Some of the important constraints are as follows:
  1. Unique
  2. Not Null
  3. Primary key
  4. Foreign key
  5. Check
These constraints are discussed next.

Unique
The Unique constraint applied on a column ensures that the column does not accept any duplicate entries. It indicates that every record in that field should be unique. However, it can accept a Null entry.

Not Null
The Not Null constraint applied on a column ensures that does not accept any Null value. You cannot leave a value blank in this column.

Primary Key
The Primary key constraint is a combination of the Unique and Not Null constraints. If the Primary key constraint is applied on a column, the column will not accept the duplicate and Null values.

Foreign Key
The Foreign key constraint is a property that guarantees the dependency of data values of one column of a table with another column of a table. A foreign key constraint, also known as referential integrity constraint, is declared for a column to ensure that the value in one column is found in the column of another table with the primary key constraint. The table containing the foreign key constraint is referred to as the child table, whereas t he table containing the referenced key (Primary key) is referred to as the parent table. The foreign key reference will be created only when a table with the primary key column already exists.

Check
The Check constraint ensures that all values inserted in a column satisfy the specified condition. This constraint checks the data against the expression defined in the INSERT and UPDATE statements.

No comments:

Post a Comment