Presentation is loading. Please wait.

Presentation is loading. Please wait.

2/16/2016Lecture 31 CS 222 Database Management System Spring 2010-11 Lecture 3 b Korra Sathya Babu Department of Computer Science NIT Rourkela.

Similar presentations


Presentation on theme: "2/16/2016Lecture 31 CS 222 Database Management System Spring 2010-11 Lecture 3 b Korra Sathya Babu Department of Computer Science NIT Rourkela."— Presentation transcript:

1 2/16/2016Lecture 31 CS 222 Database Management System Spring 2010-11 Lecture 3 b Korra Sathya Babu Department of Computer Science NIT Rourkela

2 Query Language (QUEL) QBE is graphical based QUEL is a relational database access language similar to SQL It was created as a part of the Ingres effort at University of California, Berkeley, based on Codd's earlier suggested but not implemented Data Sub-Language ALPHA QUEL was used for a short time in most products based on the freely- available Ingres source code, most notably Informix QUEL continues to be available as a part of the Ingres DBMS QUEL is purely based on TRC It can be embedded with ‘C’ only 2/16/2016Lecture 32

3 Example 2/16/2016Lecture 33 SnoSnameRatingAge 22Dustine745.0 29Brutus133.0 31Lubber855.5 32Andy825.5 58Rusty1035.0 64Horatio735.0 71Zorba1016.0 74Horatio935.0 85Art325.5 95Bob363.5 Sidbidday 2210110/10/08 2210210/10/08 2210310/08/08 2210410/07/08 3110210/10/08 3110311/06/08 3110411/12/08 6410109/05/08 6410209/08/08 7410309/08/08 bidbnamecolor 101InterlakeBlue 102InterlakeRed 103ClipperGreen 104Marinered Instance of Sailors Instance of Reserves Instance of Boats

4 Query Language (QUEL)

5 Has three clauses range of retrieve where All queries are represented with these clauses

6 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 Relational Operators used in the Predicate are,≤,≥,≠,=, ∧, ∨,

7 Equivalence The above TRC query can be written in QUEL as range of t 1 is R 1. range of t k is R k retrieve (t i 1.A 1,…,t ir.A r ) where Ψ (condition)

8 Statements in QUEL Retrieve into : Used to create a newfile and insert tuples range of t 1 is R 1. range of of t k is R k retrieve into S (A 1 =W 1,…,A n =W n ) where Ψ (t 1,…,t n ) The above query creates a newfile and insert tuples into the file Retrieve is similar to SELECT operation in Relation Algebra

9 Statements in QUEL Delete: Used to calculate the set difference range of t is R delete t where Ψ (t) Delete from R all tuples where Ψ (t)

10 Statements in QUEL append to: to append tuples to existing relation range of t 1 is R 1. range of of t k is R k append to S (A 1 =W 1,…,A n =W n ) where Ψ (t 1,…,t n ) append to is similar to Set Union operation of Relational Algebra

11 Completeness of QUEL Lets evaluate with the Five basic operations Suppose R(A 1,...,A n ) and S(B 1,...,B m ) 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 (C 1 =r.A 1,…, C n =r.A n ) range of s is S append to T (C 1 =s.A 1,…, C n =s.B n )

12 Completeness of QUEL Suppose R(A 1,...,A n ) and S(B 1,...,B m ) 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 (C 1 =r.A 1,…, C n =r.A n ) range of s is S range of t is T delete t where s.B 1 =t. C 1 and … and s.B n =t.C n )

13 Completeness of QUEL Suppose R(A 1,...,A n ) and S(B 1,...,B m ) 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 (C 1 =r.A 1,…, C n =r.A n, C n+1 =s.B 1, …, C n+m =s.B m )

14 Completeness of QUEL Suppose R(A 1,...,A n ) and S(B 1,...,B m ) are two relations and T is a new relation name Selection (σ F (R)) range of r is R append to T (C 1 =r.A 1,…, C n =r.A n ) where F

15 Completeness of QUEL Suppose R(A 1,...,A n ) and S(B 1,...,B m ) are two relations and T is a new relation name Projection (П i 1,... i k (R) ) range of r is R append to T (C 1 =r.A i 1,…, C k =r.A i k )

16 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

17 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.


Download ppt "2/16/2016Lecture 31 CS 222 Database Management System Spring 2010-11 Lecture 3 b Korra Sathya Babu Department of Computer Science NIT Rourkela."

Similar presentations


Ads by Google