Saturday, May 31, 2008

What is a Relational Database? What're Integrity Rules?

Relational Database

It's a database which stores and manages the information in tables, which are composed of rows and columns. The name 'Relational' came from that fact that the tables in such a database are nothing but a collection of similar type of information stored in form of rows. This is the reason why a table is also referred to as a relation in such a DB.

Integrity Rules

These are the rules which a relational database follows in order to stay accurate and accessible. These rules govern which operations can be performed on the data and on the structure of the database. There are three integrity rules defined for a relational databse,which are:-

  • Distinct Rows in a Table - this rule says that all the rows of a table should be distinct to avoid in ambiguity while accessing the rows of that table. Most of the modern database management systems can be configured to avoid duplicate rows.
  • Entity Integrity (A Primary Key or part of it can not be null) - this rule says that 'null' is special value in a relational database and it doesn't mean blank or zero. It means the unavailability of data and hence a 'null' primary key would not be a complete identifier. This integrity rule is also termed as entity integirty.
  • Referential Integrity - this rule says that if a foreign key is defined on a table then a value matching that foreign key value must exist as th e primary key of a row in some other table.


No comments: