0% found this document useful (0 votes)
15 views

Keys and Referential Integrity

It

Uploaded by

sravichandranvao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Keys and Referential Integrity

It

Uploaded by

sravichandranvao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

PRIMARY KEY

A primary key in a table that uniquely identifies each row and column or set of
columns in the table.
The primary key is an attribute or a set of attributes that help to uniquely identify the
tuples(records) in the relational table.
The primary key provides the means to distinguish one tuple from all the others in the
relation.
It helps the user to identify the location and also the database system to identify,
locate, and refer to one particular tuple in the relation.
Since the primary key is used to identify the tuples of a relation none of its attribute
values can be null. Since a relation may have more than one candidate key (such as
EMP_ Id, PAN no in EMPLOYEE table). So one of these candidate keys should be chosen
as the primary key.
Foreign Key
Foreign keys are a set of constraints in DBMS that
establish relationships between tables and also
ensure consistency and integrity of data.
A foreign key is applied to a column of one table
which references the primary key of a column in
another table.
CANDIDATE KEY
A candidate key in a database management system (DBMS)
is a unique identifier for a record within a table that can be
chosen as the primary key. It possesses the essential
characteristics required for a primary key: uniqueness and
minimal redundancy.
ALTERNATE KEY
An alternate key in a Database Management System
(DBMS) serves as a candidate key that is not
selected as the primary key. Its primary purpose is
to provide an alternative unique identifier for a
record within a table.
COMPOSITE KEY
A composite key is a candidate key consisting of two or more
attributes(table columns) that uniquely identify a
record/tuple (table row) or a relation.
A compound key is a composite key for which each attribute
that makes up the key is a foreign key in its own right.
Referential Integrity

It can be specified between two tables. In case of referential


integrity constraints, if a Foreign key in Table 1 refers to Primary
key of Table 2 then every value of the Foreign key in Table 1 must
be null or available in Table 2.

Note: Memorize your content book definition

You might also like