RDBMS and Relational Algebra
A relational
database consists of a collection of tables or relations. Relation is a
mathematical tern for a table. Each
table represents a relationship among a set of values. Since a table is a
collection of such relationships it is called as a relation. The figure below
represents a STUDENT relation.
Adm No
|
Roll No
|
Year
|
Name
|
Batch
|
Father
|
Mother
|
Dist code
|
22002
|
1
|
2011
|
Jibin
|
BA
|
Babu
|
Seetha
|
D-01
|
22003
|
20
|
2000
|
Deepu
|
BCOM
|
Santhosh
|
Sandhya
|
D-09
|
22004
|
13
|
2008
|
Vipin
|
BBA
|
Rajan
|
Rejani
|
D-02
|
22005
|
14
|
2012
|
Vyshakh
|
BA
|
Kiran
|
Kalyani
|
D-03
|
22006
|
19
|
2004
|
Prajeesh
|
BSC
|
Jayan
|
Jayalalitha
|
D-07
|
22007
|
21
|
2009
|
Dipin
|
BSC
|
Prakash
|
Prajitha
|
D-06
|
22008
|
9
|
2008
|
Jijesh
|
BCOM
|
Mohan
|
Latha
|
D-04
|
Domain: A domain is
a pool of values from which actual values appearing in a given column are
drawn. The year column in STUDENT
relation can have any valid year as its domain.
Tuple: The rows of a relation are
generally referred to as tuples. Each row in the STUDENT relation represents
the personal details of a particular student.
Attributes: The
columns of a relation are called attributes.
RegNo, RollNo, Year, Name, Father,
and Mother are attributes of the
STUDENT relation.
Cardinality: The number of rows or tuples in a relation is
called cardinality of the relation. The relation STUDENT has seven tuples and
hence the cardinality of STUDENT relation is 7.
Degree: The number
of attributes in a relation determines the degree of a relation. The relation
STUDENT has 8 columns or attributes and therefore the degree of STUDENT
relation is 8
Keys
Primary
key: A primary key is one of the candidate keys chosen to be the
unique identifier for a table by the database designer. But a super key is a
combination of a primary key with any other attribute or group of attributes.
Alternate
key: The candidate key that is not the primary key is called
alternate key. A single attribute or a set of attributes which is a candidate
key in another table is called foreign key. Foreign key helps to maintain
integrity of the database.