Relational Calculus and QBE

Slides:



Advertisements
Similar presentations
The Relational Calculus
Advertisements

Chapter 3 Tuple and Domain Relational Calculus. Tuple Relational Calculus.
Chapter 3 : Relational Model
1 541: Relational Calculus. 2 Relational Calculus  Comes in two flavours: Tuple relational calculus (TRC) and Domain relational calculus (DRC).  Calculus.
Foundations of Relational Implementation n Defining Relational Data n Relational Data Manipulation n Relational Algebra.
1 Relational Calculus Chapter 4 – Part II. 2 Formal Relational Query Languages  Two mathematical Query Languages form the basis for “real” languages.
1 Relational Algebra & Calculus. 2 Relational Query Languages  Query languages: Allow manipulation and retrieval of data from a database.  Relational.
Relational Calculus. Another Theoretical QL-Relational Calculus n Comes in two flavors: Tuple relational calculus (TRC) and Domain relational calculus.
Relational Calculus CS 186, Spring 2007, Lecture 6 R&G, Chapter 4 Mary Roth   We will occasionally use this arrow notation unless there is danger of.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 The Relational Algebra and Relational Calculus.
1 Relational Algebra and Calculus Yanlei Diao UMass Amherst Feb 1, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
Chapter 6 The Relational Algebra and Calculus Copyright © 2004 Ramez Elmasri and Shamkant Navathe.
Relational Calculus CS 186, Fall 2003, Lecture 6 R&G, Chapter 4   We will occasionally use this arrow notation unless there is danger of no confusion.
Rutgers University Relational Calculus 198:541 Rutgers University.
1 Relational Algebra and Calculus Chapter 4. 2 Relational Query Languages  Query languages: Allow manipulation and retrieval of data from a database.
Lecture 3 [Self Study] Relational Calculus
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Relational Calculus Chapter 4, Section 4.3.
CSE314 Database Systems The Relational Algebra and Relational Calculus Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
Database Management Systems, R. Ramakrishnan1 Relational Calculus Chapter 4.
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 14 A First Course in Database Systems.
Relational Calculus R&G, Chapter 4. Relational Calculus Comes in two flavors: Tuple relational calculus (TRC) and Domain relational calculus (DRC). Calculus.
1 Relational Algebra & Calculus Chapter 4, Part A (Relational Algebra)
1 Relational Algebra and Calculas Chapter 4, Part A.
Chapter 6 The Relational Algebra and Calculus Copyright © 2004 Ramez Elmasri and Shamkant Navathe.
Chapter 6 The Relational Algebra and Calculus Copyright © 2004 Ramez Elmasri and Shamkant Navathe.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 4 Relational Algebra.
Advanced Relational Algebra & SQL (Part1 )
The Relational Calculus (Based on Chapter 9 in Fundamentals of Database Systems by Elmasri and Navathe, Ed. 3)
Chapter 6 The Relational Algebra and Calculus Copyright © 2004 Ramez Elmasri and Shamkant Navathe.
Copyright © 2004 Ramez Elmasri and Shamkant Navathe The Relational Calculus The main reference of this presentation is the textbook and PPT from : Elmasri.
Slide 6- 1 Additional Relational Operations Aggregate Functions and Grouping A type of request that cannot be expressed in the basic relational algebra.
Chapter 6 The Relational Algebra and Calculus Copyright © 2004 Ramez Elmasri and Shamkant Navathe.
CSC 411/511: DBMS Design Dr. Nan WangCSC411_L5_Relational Calculus 1 Relational Calculus Chapter 4 – Part B.
Database Management Systems, R. Ramakrishnan1 Relational Calculus Chapter 4, Part B.
Chapter 6 The Relational Algebra and Calculus Copyright © 2004 Ramez Elmasri and Shamkant Navathe.
Relational Calculus Database Management Systems, 3rd ed., Ramakrishnan and Gehrke, Chapter 4.
Relational Calculus Chapter 4, Section 4.3.
Chapter 8 Relational Calculus.
Introduction to Relational Calculus Tuple Relational Calculus
Ritu CHaturvedi Some figures are adapted from T. COnnolly
Module 2: Intro to Relational Model
CS 480: Database Systems Lecture 13 February 13,2013.
Relational Model By Dr.S.Sridhar, Ph.D.(JNUD), RACI(Paris, NICE), RMR(USA), RZFM(Germany)
Chapter 2: Intro to Relational Model
Relational Calculus Chapter 4, Part B
The Relational Algebra and Relational Calculus
Chapter 3: Intro to Relational Model
Chapter 2: Intro to Relational Model
Chapter 2: Intro to Relational Model
Chapter 2: Intro to Relational Model
Chapter 2: Intro to Relational Model
CS 186, Spring 2007, Lecture 6 R&G, Chapter 4 Mary Roth
Logics for Data and Knowledge Representation
11/22/2018.
Relational Calculus.
Relational Calculus and QBE
Chapter 2: Intro to Relational Model
CS 186, Fall 2002, Lecture 8 R&G, Chapter 4
Chapter 2: Intro to Relational Model
Chapter 6: Formal Relational Query Languages
Example of a Relation attributes (or columns) tuples (or rows)
Chapter 2: Intro to Relational Model
Chapter 2: Intro to Relational Model
CS 186, Spring 2007, Lecture 6 R&G, Chapter 4 Mary Roth
Lecture 16 : The Relational Data Model
Chapter 27: Formal-Relational Query Languages
Relational Calculus Chapter 4, Part B 7/1/2019.
Relational Calculus Chapter 4 – Part II.
Relational Calculus Chapter 4, Part B
Presentation transcript:

Relational Calculus and QBE Chapter 8.3 2/28/2019

The Relational Calculus Like the Relational Algebra... An abstract DB language No aggregate operators R.A. and R.C. can accomplish the same results "relationally complete" "Queries" describe sets { | } with desired properties More declarative than RA: no operations! Two flavors: "tuple" and "domain" 2/28/2019

Tuple Relational Calculus Set elements are tuples from relations 'Find employees named John' {t | EMPLOYEE (t) and t.FNAME = "John"} Read as: "The set of all t such that t is an element (member) of the relation EMPLOYEE, and the NAME attribute of t has the value John." QUEL (Ingres) and to some extent SQL are base on tuple R.C. model 2/28/2019

Join Example There’s no explicit JOIN operation because there are no operations! "Find names of employees who work for the Research department" {e.FNAME, e.LNAME | EMPLOYEE (e) and (( d) (DEPARTMENT(d) and e.DNO = d.DNUMBER and d.DNAME = "Research") )} 2/28/2019

Relational Calculus vs. Predicate Calculus Both flavors of R.C. are extensions of the predicate calculus Can give formal definitions of terms, formulas, scoping and binding of variables, etc. can build a model theory with TRUE, FALSE P.C. quantifiers like , and operators like  (not) can be used Care must be taken with  and  2/28/2019

Domain Relational Calculus The variables represent individual domain values (rather than whole tuples) "Find employees whose pay is over $25,000" {f,n | ( p) EMPLOYEE (f,m,n,s,b,a,x,p,u,d) and p > 25000} This is already a shorthand: should say f exists and belongs to the domain "string", etc. etc. for each variable. 2/28/2019

Domain R.C. Join Example "Find employees of the Research dept. whose pay is over $25,000" {fn,ln | ( p) ( d1) (EMPLOYEE (fn,m,ln,s,b,a,x,p,u,d1) and p > 25000) and ( d2) ( dn) DEPARTMENT (dn,d2,mg,ms) and d1= d2 and dn="Research"} Many of the variables are just placeholders. In Prolog you could use "anonymous variables" (_). 2/28/2019

Not so abstract, really... "Query by Example" uses this framework User see 2-dimensional layout of schema Can select which tables are involved, which columns (variables) appear in output (i.e., what vars are to the left of |), what conditions apply between columns, etc. etc. This is the predominant paradigm in direct end-user query systems (e.g. Microsoft Access). 2/28/2019