Monday, February 8, 2010

Relational Model Concepts by anil nain

Relational Model Concepts

The relational model is an abstract theory of data that is based on certain aspects of mathematics (principally set theory and predicate logic).

The principles of relational model were originally laid down in 1969-70 by Dr. E.F. Codd at that time a member of IBM. Relational model is a way of looking at data. The relational model is concerned with three aspects of data: Structures, data integrity, manipulation(for example join, projection etc.)

1. Structure aspects: the data in the database is perceived by the user as a table. It means database arranged in the tables & collection of tables called database. Structure means design view of database like data type, its size etc.

2. Integrity aspect: Those tables that satisfy certain integrity constraints like domain constraints, entity integrity, referential integrity and operational constraints.

3. Manipulative aspects: The operators available for the user for manipulating those tables into database e.g. for purpose of retrieval of data like projection, join and restrict.

Top

Relational Model Constraining

PURPOSE: Used to validate data entered for the specified columns (s) namely:

There are two types of constraints

· Table Constraint

· Column

Table Constraint

If the constraint spans across multiple columns, the user will have to use table level constraints. If the data constraint attached to a specific cell in a table references the contents of another cell in the table, then the user will have to use table level constraints.

Primary key as a table level constraint:

E.g. Create table sales-order-details (s_order_no var char2 (6),

Product_no varchar2(6),…. PRIMARY KEY (S_order_no, product no.));

Column Level Constraint

If the constraints are defined with the column definition, it is called as a column level constraint. They are local to a specific column.

Primary key as a column level constraint

Create table client (client _no varchar 2(6) Primary key…);

by anil nain