Database relatinship

Preview:

DESCRIPTION

 

Citation preview

Relational database matches data by using common characteristics found within the data set.

Primary keys

Foreign keys

Relationship Types

The primary key of a relational table uniquely identifies each record in the table.

It can either be a normal attribute that is guaranteed to be unique (such as Roll No in a student Table or Employee Number in Employee Table)

A foreign key is a field in a relational table that matches the primary key column of another table.

The foreign key can be used to cross-reference tables.

A relationship exists between two database tables when one table has a foreign key that references the primary key of another table.

One-to-one: Occur when there is exactly one record in TableA that corresponds to exactly one record in TableB.

One-to-many: Occur when each record in TableA may have many linked records in TableB but each record in TableB may have only one corresponding record in TableA.

Many-to-many: Occur when each record in TableA may have many linked records in TableB and vice-versa.

Recommended