You are on page 1of 7

14 DDU L'{.

-L
DATE:

t\ a

: v, tUffie$; g# S, +*k, ojr .fMP"+:f& @


4.
\d Aa 'Wktlrv& -vL l
';fuii,{$+ $'4id
!
-frt
3* "}*tel.' tnta*l*ro rx*.dJr.-i.e*calti,<tf,i,r..'n o{. q{s}ti& 4#fu.s/an^s,
V

,Eery\ - g{ e{. ,rtpfl,flo val^^{r &+f$J


v ,
Jatl t pplsJr<$.,uto .-,6./
v v \t

M+ ,#-s4t,t- ruill}clL d*.*<-wfuL6 M ox_d*g*t*-


C-
*t*t 4- *lat*\Q. d.oril.-
L U

4- ReJ^r,ns* Sr|,npr,,,o,a, R R a >1a

- --be bu**
n{kx'' *>- -> *4X# *1
\
v1 faz q*t$,ihufi, Ai U Jc^r )rr. , o{- a-Ao{+ p!+f*a, btt(I ^t*rvo-
8,&t
\4 a

s L*t ) 4 ,l^yrn
\a Y
fufibrt&t Ji ,hlt, *vt,,,;b tJLEr a#;bu*<rte
v

_&r{s.h's4 g,.baf& {xCR}l


dlr"- aeafi,
t
a
fuRf&rF--rri)
q + r-h^;riltb
S-c*, tt.z r **tn L E,.$+ a

€ te* **@* b fu a,w gAu*d, Jis;b *ava-b^tt


t4d^ Vo&Al- vL ) 11 i € yt rt A^1qlg4,u,hfr
* lrl *Vn),r^ra&,t

M (tr) s{ trluLL,
,.1
3fi&v6"[,ut ,rit b^*lL+ 4^d4]u&L i*r*,xu^ggn*tJ.tB &rL aJtlib;u..b Ai
T_-.-

t
h e.6 t{* I f,t 96 f,, *; I

* Xit l"rt*A"* W lL t (9) n, rdtfi e^ &^afuen


-f'
a
rx $+ fuj"g-#waM ,{F
qf€--.
i$r

a
tH - fuft{A *.ed-" Js
t* anr,ta,ti $'

2, &h 4- k?-
I Y rc il-fl

3, Val;gil fi"";" Nu,*s A WUr* - hllJu-q sv&e*@


+ $*wl*nyUtsr
j
Lr'tt*;*J *o Pr**- tr\,
Watra{;am,$,uXr
{.e@*
Aftil*,r-ilF\fiffie
4-.u^t" E

f**r*?sel tf h^A*-t) {
f".*-#*.,ilt+,L]**
*rc t .fo,* * : *- ". -. l
i^;,t.;",i:?1 "
A

I
!
$

I
-t:

}'
"

{*-}*-ut*}'tj,} i
\
re *+. - , i'::
i Et ;

#-ee
t
fLq i., t i ,if #, f}' ac ffI
RI,LATIONAL MODEL CONSTRAINTS
1 . Inherent Model-Based constraints (Implicit constraints) :
- Constraints inherent in the data model
- Ex: no duplicate tuples, absence of ordering of
tuples, and restrictions on composite attributes
2. Schema-Based Constraints (Explicit Constraints) :
- Constraints expressed directly in the schemas of the
data model. Specified in DDL
- Examples: domain constraints, key constraints,
constraints on NULLs, Entity IC, Referential IC
3. Application-Based or Semantic constraints (Business
Rules):
- Constraints not directly expressible in the data model schemas.
Must be enforced by application
programs or other means. Ex: Assertions and triggers in
SeL.
Types of schema-Based constraints (Expricit constrainis)
1. Domain Constraints:
- Values of attributes must be atomic values frcm
fl1.i, respective domains.
- Domains include integers, real numbers, characterc.
BooGans, strings, date,time,and timestamp.
2. Key Constraints:
- superkey: subset of attributes ensuring uniqueness of
tupres.
- Key: Minimal superkey; uniquely identifies tuples.
- Candidate key: Altemative keys.
- Primary key: Designated key for identifying tuples.
- Examples: Keys in the sruDENT relation
andcAR relation.
3. Constraints on NULL yalues:
- Specifu whether NULL values are allowed for attributes.
- Example: Name attribute of STUDENT cannot be
NULL.
4. Entify Integrity:
- Primary key values cannot be NULL.
- Ensures identification of individual tuples.
- Example: Ensuring distinct primary key values
in EMpLoyEE relation.
5. Referential Integrity and Foreign Keys:
- Ensures consistency among tuples in related relations.
- Foreign keys reference primary keys in
other relations.
- Example: Dno attribute in EMPLOYEE referencing
Dnumber in DEpARTMENT.
- Diagrammatically displayed using directed
arcs.

Update Operations, Transactions, and Dealing with


Constraint Violations
1. Insert Operation:
- Provide attribute values for a new tuple to be inserted.
- Can violate: Domain constraints, Key constraints,
Entity integrity, Referential integrity
2. Delete Operation:

- Can violate only referentiaiintegrity. Wvt- wr*"v4'v&


- Options for handling violations: ,l*, J{w+.t
oRestrict: Reject thedeletion. ' e,+i t+.
f4f?s{-'.*tiq,S
ocascade: Automatically delete referencing tuples. :,r-rr.i 3..*r.tr,r,
oset null or set default: Modifr referencing varues'
ervrs,u,rB aturuurs
attribute values.
3. Update operation: L**^lU
- Modifu values of attributes in tuples.
- Specify conditions to select tuples to be modified.
- Can violate constraints similar to insertion.
- Handling constraint Violations same options
- - restrict, cascade, set null/default
modifying foreign key attributes, ensure the new value refers
to an existing tuple or is set to NULL

I II
I
RELATIONAL ALGEBRA
Unar-voperation. _ /a\ R;aj4Jf-On R
1. The SELECT Operation %on l,irnor,, LH J
The SELECT operation is used to choose a subset ofthe tuples &om a relation that satisfies
a selection
condition. It acts as a filter that keeps only those tuples that satisfy a qualifring condition
(rL'.- 1,? Lilt Jrah&#umrv vnY' w
't v 6*aeo
foq, -- e C sa4ler*)
2'
fi: IffiHEI3##[T*,""* *%mmr*]]"
*0," and discards the ot]rer cor'runs. rronry certain
at&ibutes of a relation are needed, &en the PROIECT operation is used to project &e relation
over these
athibutes only
h'.-aorrkE.,,rf dL ugNs fl us,v ( ger^fu^*\

3' RENAME operation can rename eitherthe relation name or the athibute names, or both-as
a unary operator.
The genere-l is denoted by any of the following three forms:
'pt"d - t* Yq,rn{ydt4{-.

3cry"ro) qia-- IE Axe [-*tst*psr't@)


Relational Algebra: SET TI{EORY
Union Compatibility - Two relations R(Al, A2, ..., An) and S(Bl, 82, ... Bn) are said to
, be union compatible (or
gpe compatible) if they have the same degree n and if dom(Ai) : dom(Bi) for 1 < i <
n.
This means ihat the two relations have the same number of attributes and each corresponding
pair of attributes has the
same domain
The tirree operations UNION, INTERSECTfON, and SET DIFFERENCE are
defined on fwo union-compatible
relations R and S as follows:
o UNION: The result of union operation, denoted by R u S, is a relation that includes all tuples that
are either in
R or in S or in both R and S. Duplicate tuples are eliminated.
o INTERSECTION: The result of this operation, denoted by R o S, is a relation that includes all tuples that
are
in both R and S.
a SET IIIFFERENCE {or MINUS ): The result of this operation, denoted by R S, is a relation that
tuples that are in R but nst in S.
- includes all

& fu"^d' & *nc. ur'u*,# ffie c.or\"lf *#ure- LA,o


Au6 '\AnB &.*&
il fnar,lu
L& ,\tllb I& I.
f , ,.of
ir,$ ,f,i; a& ffitupee
:
r lo ft
o
I t.

L ,IZ
*.
*s/

tz
T
t

L ( t
B

3 ,11
c}
-{* le
B
r3
3 l3
u ,1
{i'.ts
.
.F
$

t' t
+ $+
2 IL
3 t3
+ r+

,
t:
-IIt-fiFF

,a
a]

1?
o g)

3.1,.{r

L bli{c4 ,h*{-I}6, 2.ii\


$Cfii $? i,
*-':i

I
b
t
*

i\t
{ -j'
t-t
i1
* Rxg-
lr
{ +
,' r t'

ir
lu-
i+
I
-r
V

8.,
I

'L {a
,=t
;ts:.-::
.

.,s-$\J .
-.l i,"ji.* B*: r/.i
E

tF
E
+
f
l*

ra ir. ,.r '.i :. .\

'-J lh

J :t
e *
,.t

g::_
,\!.,-It ag
.I S&ur, tu
.a-
aa-

+e %
.,1
$ *ea L) i -t J*m '€ I

$
\l^ r NIJ
/\0
L Y

11

\ ,
k-t\tr d
d

€rnP
fru, * ?
eEsE&R d*+DsP

N# #t.ru#
3
I

t;,)ti..-' :k

LlSl* &fanrwe

e
&
ft $
ii
ti
US r{ t' jl'irt+.€- Sr; Pf:
n fr q,. g
3
a "..
3E*\
t. t i:
l.J
1"i;#
-b

.*
fa r..r ****-
r .ji

Lrj d
.L
1
?
t.
-t
*"+
t
i--.' !

+ .1i
!jj

* re1 Bniqh I

J
'- Lr Lbf{r lC,-t >5n L= Y>rr1:
.r* R- s-\ aJ.-g* in "s ffL4u_ &
\
T t!-* * I

iJ

I A , I. ; *",$.*
B I-'i

c 3
TL
a
-,J

ffierE@
tu
*.#i**;i*; . i r.f* EU
o{
FerHa-*ais

T
iCii-.*Lfi$fi.E*.<ri-

d" p -?
e( { *
s B {
ft A * .A
I w
l' A I * t
t +
\,, B L I L 5 B l--
,1
r
s € C NULL 3 Ntl, 6 C 3 ilJULL
E
\=u

rtfxTz
t

TI reTL D NULI- €
tr
I
t
.!

l
U i
1,

t) lr
i

T tur*:@{ryie

'J,
SI
k@{ee!@ JC+{-
a
rlrt ill
T ll
.t
.!:
I 4r
r{ -J
i1
t:+*.
s )
+i
li
ll
11

E
lr
e@%-_ 't,"f ir
+:4. , .i -.- :

R. *
.:r
.i
)ltl
fi/tafii^d -n
J

!'
{h

I
r { a\

1i
\*
e ": C,g ti
Nq/ryi"g . \-r:'i .t.r il
ji
t i i-q
-.ta-r: ,l

C"'g
A li
rl
Fl I

.t
\rz

x \ li
tl
I
;-.11 1oi ,L$ 1l
{l
{d
r.t
r-J
ll
tl I
_$ 'l
it

\
t\
:-t
'ti
e..@.-*.
, il
t

ir
_t

1
*..l%..*-,n,@i.*..
b ,l
1

S-* t
It ,-*'i S
1
i
I

i
J
1

uvv,*c4&
H ,r.-iY ',.-i{.:
.J!-
*. i;.'

gf €-Z
Cs e3 Lz €-g
a
\-,
,{-
f)
€-3 9g-
eg p
\r +-
E.#l €,-q-
I
i

?-.* €q-
+-
\
CTlcft] S E[V U:

vl 4,{d "l*,o^ q;;u-xtu,


€ *_L\A _-5 gunft , MlgAn.+,gf q frtf,ixr, rA DIVLr Rnt N rn&uF1

t COUNa t{A{*d. t"{


d
J a
.9ryt .I/rt .e4
,e{il q.{&tb&tr* a64A fi^{ift q+ph M
fr oadl- gfl^eutfo,
a
e ?.ra (F;n4P)
lt
-+--

'(t
*
- SH#l
-t- -M 6 L
f\,4#
Elr^A *J&qtL&#e !.

I
i
i
,
I
t
C
r

Stepz €c'xrv e"#I{ 1 €l4b . q- +t;.;vrt tafa-h>*ir L tru,kt- -fu-o pL


t
,lna,fr AA
L ffii,
r i.'
i
'- 3
f
! F_..
1u; Na/brLL
=j6:---

gn+r f*A ['" {*Ir*f\y4 t

gb _\
b 0^*l !

*#
FE
Pg"F * n*,pxg $"9

q,tp+
I
w r:{v 4 .(
3i& f\\
JffiJa w T
F-

.J e.-.Ss
$* f.'
s &*k
t

i
?

A€kiwen
fIr .{

.:


g,ttPs hsq rv!: 4Ajtrn)"
---f-"-
EAI tt X
.t& r.i
;-

t
ii

fr-i i \
:E
't li
"
tt1* *

,.-.;a J
1 *{r
i.i 3**+ ' -\*oi

\f'*}

ifr) "i ;*.i] ,,.,**+-:vrv#I)= 3


:1. -

,.-d i;^
:
lrl-J r-1{'
rF ,'.-i: ,,, ;f i_,Tii t , -!
:

r*
t**
t 'u d. Pan *,-t
a*'-\ 'rt'i
.3 *
], ,i :i .Ftiut 1 '-. 'o',,
*
, t. '"!n..q" i

g,w1 t{L t.rl*g\bfl"tt/'qip +lerr* fuAbl&


*dt*

$,,q;b{r{ o
L
-- -{- € p ;. *:
---.I-:--' -' - - --'lJ--
/i

+,{ 1 '.,'ii '. ,3

&ii--idra*@.
1t ilJ ,*

ts-1:,.'@!&*,r€{S

F -i&6-,1 :'!"F{*r -1'r'!.

-'t q.dt .t *if,, ti , .iqt f; 'J f; -], t*=1., 1.,.,.1 l -:r,',. F


t

_t
.1 ..+.
*.i ,; -it t i r."- .i I r.'l i.,.,'. * ir]+-.t, .:tr
" I l,i .;-' . ,-*' i' - r,,-,i*,,,i G
- f .ii,.f t- irlf i* :i "l

.a@#',! Y.4

&"'s6.@kan-F

-:jll'rr;!:t!c@.+i..-r!.!^!i:s-

e-lfur'.q1llffi.M*-'r\-

G<!ga*$s.'- -*!ir ]-:1!:,. :- -

i
i'r
,i1. t -td q t":"'$

You might also like