Relational Model in DBMS
Relational model can represent as aftabid with columns and
rows.
cdo Atsilode, gy
Rew Tule o Aude |-— Add)
Example: STUDENT Relation
[NAME ROLL.NO “Prose. No ADDRESS
aarp =f 4479— 7305758992 Noida
Shyam 12839 | 9026288936 Delhi
Laxman 33289 8583287182 Gurugram
Mahesh 27857 | 7086819134 Ghaziabad
Cah | 17282 9028 913988 Delhi
AGE
24
35
20
27
40
Domain: It contains a set of atommiesvaiwes that an attribute
can take
Atterisete: |t contains the name of a column in a particulartable. Each attribute Ai must have a domain, dom(Ai)
infstanee: finite set of tuples. Relation instances do not have
duplicate tuples.
schema: A relational schema contains the name of the
relation and name of all.columns or attributes.
key: In the relational key, each row has one or more
attributes. It can identify the row in the relation uniquely
Types of Database Keys
+ Primary Key
+ Candidate Key
+ Super Key
+ Foreign Key
Primary Key @
It is a unique key.
It can identify only one tuple (a record) at a time.
It has no duplicate values, it has unique values.It cannot be NULL.
ae
Primary keys are not necessarily to be a single column; more
than one column can also be a primary key for a table.
Candidate Key
The minimal set of attributes that can uniquely identify a
tuple is known as a candidate key. For Example, STUD_NO in
STUDENT relation.
+ Itis a minimal super key.
+ It is a super key with no repeated data is called a
candidate key.
+ The minimal set of attributes that can uniquely identify
a record.
+ It must contain unique values.
+ It can contain NULL values.
Cpe)
Super Key F (4 CA )
(ex+ ery M1
Super key is an attribute set that can uniquely identify a
tuple. A super key is a superset of a candidate key.
Seger (ADS anc? § peo}+ Adding zero or more attributes to the candidate key
generates the super key. ADE
cf
- Acandidate key is a super key but vice versa is not true.
+ Super Key values may also be NULL.
Foreign Key
+ Foreign keys are the column of the ta éd to point
to the primary key of another table.
Si ce Sta
- Every employee works in a specific department ina
company, and employee and department are two
different entities. So we can't glore the department's
EMPLOYEE EMPLOYEE
Cm
Cua
Perea naa)
information in the employee table. That's why we link
these two tables through the primary key of one table.Functional Dependency
The functional dependency is a relationship that exists
between two attributes. It typically exists between the
primary key and non-key attribute within a table.
= Xe Ko
datenn Deed
The left side of FD is known as a determinant, the right side
of the production is known as a dependent.
Emp_ld ~ Emp_Name
ABC DE
F Ges )
LAB ABCD E
CK
o€
ae
A a Pans Atv
Prem Sivoo3),
RkO ere
¢ a
S
whieh g the FD salisgd by ™
lastants
xy oe
a) (XY ZS 9 ere
27"
xv 4) raf
ie ee Y¥ 2
a —_
(0) X2—2x eoc_\ssute
cacao
pt= BC
cre
ee”
1h,
at = ABCD
&
KO = ABCD