DBMS Mod 2 ppt
DBMS Mod 2 ppt
Schema of a Relation
Degree of a Relation
Relation state
Schema of a Relation
It is basically an outline of how data is
organized
It is denoted by R (A1, A2, .....An)
◦ R is relation name and it has some attributes
A1 to An
Each attribute have some domain and it is
represented by dom(Ai)
For example, the domain of Cust-id is 6
digit numbers
Degree of a relation
Degree of a relation is number of
attributes in a relation
Eg STUDENT(Id, Name, Age,
Departmentno) Has degree 4
Using datatype of each the definition can
be written as
STUDENT(Id:Integer,
Name:String,Age:integer,Departmentno:in
teger)
Relation State
The relation state is a subset of the
Cartesian product of the domains of its
attributes
each domain contains the set of all
possible values the attribute can take.
Example: attribute Cust-name is defined
overthe domain of character strings of
maximumlength 25
◦ dom(Cust-name) is varchar(25)
A relation state r(R) is a mathematical
relation of degree n on the domains
dom(A1), dom(A2)…, dom(An) which is a
subset of Cartesian product(X) of
domains that define R
Student Relation
Rollno Name Class Section Age Address
1 Akhil 10 A 16 EKM
2 Amal 10 A 16 TVM
3 Aji 10 A 16 EKM
1 Ali 10 B 16 TVM
2 Akhil 10 B 16 TVM
Student Relation
Rollno Name Class Section Age Address
1 Akhil 10 A 16 EKM
2 Amal 10 A 16 TVM
3 Aji 10 A 16 EKM
1 Ali 10 B 16 TVM
2 Akhil 10 B 16 TRC
Student Relation
Rollno Name Class Section Age Address
1 Akhil 10 A 16 EKM
2 Amal 10 A 16 TVM
3 Aji 10 A 16 EKM
1 Ali 10 B 16 TVM
2 Akhil 10 B 16 TRC
Primary Key
Data base designers while designing the db
which choose any of the candidate key to
uniquely identify a record in a relation which
will be considered as Primary Key
Relational Schema
Database Management System
Module 2
Lect 3a : RELATIONAL
ALGEBRA
RELATIONAL ALGEBRA
Relational Algebra is procedural query
language, which takes Relation as input and
generate relation as output
The basic set of operations for the relational
model is the relational algebra
These operations enable a user to specify
basic retrieval requests as relational algebra
expressions
Relational algebra is composed of various
operations.
The SELECT Operation
The SELECT operation is used to choose a tuples
(rows) from a relation that satisfies a selection
condition.
In general, the SELECT operation is denoted by