Monday, November 30, 2009

Relationships in RDBMS

The relationship in a RDBMS refers to the relation which exists between data of one table and data of another table. There are three kinds of relationships:

1. One to One relationship: In a normalized table, preference should always be given to one-one relationship. This means that a particular column in a table should have a one-to-one relationship with the primary key. In other words, if we know the value of the column we will immediately know the value of the primary key.

2. Many to one or one to many relationship: This refers to the relation between a single primary key and many foreign keys or a single foreign key and many other primary keys. In such relationships, a table is present where each key column of the different tables are included.

3.Many to many relationship - An example of such a relationship is a supplier supplying different parts and a part being supplied by different suppliers. In such cases, a third table is created which will hold the supplier as well as the parts tables’ columns.

0 comments: