Escolar Documentos
Profissional Documentos
Cultura Documentos
{t/p(t)}
t is a set of tuples such that the predicate
is true for the tuple t
LOAN RELATION
lno
bname
amount
11
12
13
14
Round hill
Downtown
Perryridge
Perryridge
900
1500
1500
1300
Acno
Hayes
Johnson
Jones
Lindsay
102
101
201
217
cname
Lno
Adams
Curry
Hayes
Johnson
jackson
16
93
15
12
14
THERE EXISTS
EXAMPLE QURIES
The above depositor and borrower relation is use these
queries
o
Find the name of all customer who have loan from the
perryridge branch
{t / s borrower (s[cname]=t[cname])^ u
loan(u[lno]=t[lno])^(u[branch]=perryridge)}
It require two there exists clause that are connected by
AND(v) symbol
o Find the name of all customer who have loan an accont
or both at the bank
{t / s deposit (s[cname]=t[cname])v u borrower
(u[cname]=t[cname])}
If we want only these customer who have both an account
and a loan at the bank
o
FORMS
<x1,x2..xn>tr
where r is a relation on n attribute and x1,x2..xn
are domain variables
x y
x , y are domain variable is the comparision
operator
x c
where x is a domain variable is the comparision
operator and c is a constant
RULES
we built-up formula from atom by the following rule
If p1 is a formula then p1 is also formula
If p1,p2 are formula then p1Vp2,p1^ p2 ,p1 p2
also a formula
P1(x)is a formula then
x p1(x), x p1(x) for also
a formula
EXAMPLE QURIES
The above depositor and borrower relation use
these queries
Find the lno ,bname and amount for loan of over
1200
{<l,b,a>/<l,b,a> loan^a>1200}
o Find the name of all customer who have a loan,an
account are both at a perryridge branch
{<c>/ < l,c> borrower^ b,a<l,b,a> loan ^
b=perryridge} v n <n,c> depositor ^ b,a
<n,b,a> account ^ b=perryridge}
SAFETY OF EXPRESSION
A tuple relational calculas may generate
an infinite relation suppose we write the expression
{t/(t loan)}
there are infinetly many tuples that are not in loan
tables it is unsafe