Академический Документы
Профессиональный Документы
Культура Документы
Database Management
System
Spring 2010-11
Lecture 3 b
Korra Sathya Babu
Department of Computer Science
NIT Rourkela
03/15/15
Lecture 3
03/15/15
Lecture 3
Example
Sn
o
Sname
22
29
Sid
bid
day
bid
bname
color
22
101
10/10/08
101
Interlake
Blue
22
102
10/10/08
102
Interlake
Red
33.
0
22
103
10/08/08
103
Clipper
Green
22
104
10/07/08
104
Marine
red
Ratin
g
Age
Dustin
e
45.
0
Brutus
31
Lubbe
r
55.
5
31
102
10/10/08
32
Andy
25.
5
31
103
11/06/08
31
104
11/12/08
58
Rusty
10
35.
0
64
101
09/05/08
64
102
09/08/08
74
103
09/08/08
64
Horati
o
35.
0
71 Instance
Zorba of 10
16.
0
74
Sailors
85
Horati
o
35.
0
Art
25.
5
03/15/15
Instance of Boats
Instance of Reserves
Lecture 3
range of
retrieve
where
Syntax
range of of t is
R
retrieve t
where Predicate
Similar to (t(R))
Similar to Select Clause in
SQL
Similar to where in
SQL
<,>,,,,=, ,,
Equivalence
{U r | (t )....(t )( R (t ) ... R (t ) U [1] t [ j ] ... U [ r ] t [ j ] Conditon )}
1
i1
ir
range of tk is Rk
retrieve (ti1.A1,,tir.Ar)
where (condition)
Statements in QUEL
Retrieve into :
range of t1 is R1
.
.
range of of tk is Rk
retrieve into S (A1=W1,,An=Wn)
where (t1 ,,tn)
The above query creates a newfile and insert tuples into
the file
Retrieve is similar to SELECT operation in Relation Algebra
Statements in QUEL
Delete:
range of t is R
delete t
where (t)
Delete from R all tuples where (t)
Statements in QUEL
append to:
range of t1 is R1
.
.
range of of tk is Rk
append to S (A1=W1,,An=Wn)
where (t1 ,,tn)
append to is similar to Set Union operation of Relational
Algebra
Completeness of QUEL
Lets evaluate with the Five basic
operations
Suppose R(A1,...,An) and S(B1,...,Bm) are two relations and T is
a new relation name
Union (T=R U S) (assuming m=n)
range of r is R
append to T (C1=r.A1,, Cn=r.An)
range of s is S
append to T (C1=s.A1,, Cn=s.Bn)
Completeness of QUEL
Suppose R(A1,...,An) and S(B1,...,Bm) are two relations and T is
a new relation name
Set Difference(T=R - S) (assuming m=n)
range of r is R
append to T (C1=r.A1,, Cn=r.An)
range of s is S
range of t is T
delete t where s.B1=t. C1 and and s.Bn=t.Cn)
Completeness of QUEL
Suppose R(A1,...,An) and S(B1,...,Bm) are two relations and T is
a new relation name
Cartesian Product (T=R X S)
range of r is R
range of s is S
append to T (C1=r.A1,, Cn=r.An, Cn+1=s.B1 , ,
Cn+m=s.Bm)
Completeness of QUEL
Suppose R(A1,...,An) and S(B1,...,Bm) are two relations and T is
a new relation name
Selection (F(R))
range of r is R
append to T (C1=r.A1,, Cn=r.An) where F
Completeness of QUEL
Suppose R(A1,...,An) and S(B1,...,Bm) are two relations and T is
a new relation name
Projection (i ,... i (R) )
1
range of r is R
append to T (C1=r.A i ,, Ck=r.A i )
1
Example
Find the name and rating of Sailors whose rating is greater
than 7
range of t is Sailors
retrieve into SN (S=s.Name,R=s.Rating)
where rating > 7
Summary
QUEL is purely based on TRC.
It is quite expressive (relationally
complete).
Majority of the DBMS incorporated earlier
with QUEL are replaced by SQL.
Still lives in the open source community.