Friday, 21 September 2012

M1

M1


Relational Integrity
Referential integrity is a database concept that ensures that relationships between tables remain consistent. When one table has a foreign key to another table, the concept of referential integrity states that you may not add a record to the table that contains the foreign key unless there is a corresponding record in the linked table. It also includes the techniques known as cascading update and cascading delete, which ensure that changes made to the linked table are reflected in the primary table. 

Primary Keys
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 Social Security Number in a table with no more than one record per person) or it can be generated by the DBMS (such as a globally unique identifier, or GUID, in Microsoft SQL Server).

Foreign Keys
 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. 

Database relationships are similar to relationships in the real world, for instance your parents, siblings and other family are all relations. 

Relationships

One to one relationships; each primary key will relate specifically to one or none record in the table
One to many; This primary key will relate to one, none or more than one records in that table
Many to many; Each key in both tables can relate to more than one or any number of records.

2 comments: