You are on page 1of 18

A-LEVEL

COMPUTER SCIENCE BY
AAQIB KHAN - AKI
CHAPTER - 6
DATABASE LECTURE 2
RDMS & KEYS

YOUTUBE CHANNEL:
CS BY AQIB KHAN
CONTACT: +92 314 5030717
(9678)
SANQiR AS LEVEL
-

A
cH8 5)

->

RECTURE#2 outubeis]
ATONAL
DATABASE
structured collection ofitems of data that
↑ATABASE can A
differentapplication pOOgRAM
Be
by
accessed

-
#s
I TABLE
Types ofDATABASE

-
-
pisdational
DB
2 OR TABLE
MORE
called Based
Approach thatare link
gether
-
Also ~
To

Form Relationship
-

- Relational Pipity
# Project-TABLE
1)

EmpcEMPLOYETwane
TABLE

Column/field/Attribute
-

~>
at ame
salary
DO B

ABusiness Keeps Separateroll


files and
defiles Row/RecoRD/Tuple

openotatinocators
- ->

EachFile is asses
By Differen
Application
-

en

poico
file Based p| PRimary Key (PK) Enique identifer
=

Approachis Limited Because: -

70 Reign (*)(F1) Setof


=

attribute in

① Stage space is wasted when data items are duplicated TABLEthatRefer


One

applicationsand data Rexfondant


Byseparate some to PK another table
in

② Data altered Application


By
Can Be One

and notby anothers -

itthen Become
consistent
Enquiries
1

pretendstructure
atan
Depends
available can
of
on

and the software used


not independent
FK

g.***
1
↑ S

Onique Erique Unique


5
Types ofKEYS in RDmS

① CamiDATE KEY -->


Any attribute/ Attributes that
can

Qualify as
Unique KEY
WPK(PRimary KEY) ->Value in each TupLEis
Unique
candidate key that
③ SK(SecondaryKEY) -> is an
a is

alternative to
primary key
Ek(foign KEY) -
I Attribute/Attributes
to
-
in one

anothere
table that
to form
link

primary key table


a in

a Relation

CompositE KEY -- when 2 Attributes combined together to
make one
primary Kay

CompositeKEY
-ooooon,wolnusi
Musq

p
nes

ComposiEKey
80 sil
0
->

->

2
-

L
-
->

-> C

->

->
o
->

-5

->
#as
Redundancy
Repeated Data
->

Database
exog Adata
-

structure Builtfrom One OR

more Columns in
Database
dats
To
speed up Scarcing FR
ppQ ->

X

->

② ⑤
->

or -ia/"

->


->


->

->

->
ppQ >
-










situation in which
ELArioNSHlSEHas a
Foreign By
thatRefers to a

primary anothers table


Key in

->
--

f--

-2
-

->
Many
may
->

PHOTO
* USeR < TEXTPOST
=
2ay!
- pental
Integrity
S that does notcontain any values of
database
property of
a a
&

Foreign that not


key matched to corresponding primary
key

0

Δ Retential <

- integrity
-
297
- -

May -
one

o
PK

OFK

o
⑳7
④I
->

May
-

2
-

<

C 5
man

You might also like