Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Appendix C Overview of the QBE (Query-By-Example) Language.

Slides:



Advertisements
Similar presentations
Microsoft Access Course 1. Introduction to the user interface.
Advertisements

1 Query-by-Example (QBE). 2 v A “GUI” for expressing queries. –Based on the Domain Relational Calulus (DRC)! –Actually invented before GUIs. –Very convenient.
Database Management System Module 3:. Complex Constraints In this we specify complex integrity constraints included in SQL. It relates to integrity constraints.
Database Management Systems 3ed, Online chapter, R. Ramakrishnan and J. Gehrke1 Query-by-Example (QBE) Online Chapter Example is the school of mankind,
5/15/2015Lecture 31 CS 222 Database Management System Spring Lecture 3 Korra Sathya Babu Department of Computer Science NIT Rourkela.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Query-by-Example (QBE) Chapter 6 Example is the school of mankind, and they will learn at no.
Domain Relational Calculus and Query-by-Example CS157a John Eagle.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 8- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 6- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 2- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 4- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 9- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 18 Indexing Structures for Files.
© 2010 Pearson Education, Inc. All rights reserved.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Object, Object- Relational, and XML: Concepts, Models, Languages,
Temple University – CIS Dept. CIS331– Principles of Database Systems V. Megalooikonomou Query by example (based on notes by Silberchatz,Korth, and Sudarshan.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide AppC- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 6- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 The Relational Algebra and Relational Calculus.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Vectors and Vector-Valued Functions.
Chapter 6 The Relational Algebra and Calculus Copyright © 2004 Ramez Elmasri and Shamkant Navathe.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 Part 1 Conditionals and Loops.
©Silberschatz, Korth and Sudarshan5.1Database System Concepts Chapter 5: Other Relational Languages Query-by-Example (QBE) Datalog.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 11.9 Curvature and Normal Vectors.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Limits.
Chapter 8 Section 2 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Chapter 8 Relational Calculus. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.8-2 Topics in this Chapter Tuple Calculus Calculus vs. Algebra.
CSE314 Database Systems The Relational Algebra and Relational Calculus Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10 Parametric and Polar Curves.
©Silberschatz, Korth and Sudarshan5.1Database System Concepts Chapter 5: Other Relational Languages Query-by-Example (QBE)
Chapter 9 Query-by-Example Pearson Education © 2009.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 11.5 Lines and Curves in Space.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 4 Applications of the Derivative.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1 Functions.
Copyright © 2006 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Common Factors and Factoring by Grouping Terms with Common Factors Factoring.
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.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 Part a The Relational Algebra and Relational Calculus Hours 1,2.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 The Relational Algebra and Relational Calculus.
The Relational Algebra and Calculus. Slide 6- 2 Chapter Outline Relational Algebra Unary Relational Operations Relational Algebra Operations From Set.
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.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 5 Integration.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 11.6 Calculus of Vector-Valued Functions.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 Integration.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 The Relational Algebra and Relational Calculus.
Chapter 6 The Relational Algebra and Calculus Copyright © 2004 Ramez Elmasri and Shamkant Navathe.
CSC314 DAY 8 Introduction to SQL 1. Chapter 6 © 2013 Pearson Education, Inc. Publishing as Prentice Hall SQL OVERVIEW  Structured Query Language  The.
Jun-Ki Min.  Based on predicate calculus ◦ Predicate  a function whose value is true or false  non-procedural ◦ A relational calculus expression creates.
Query-by-Example (QBE)
Chapter 9 Query-by-Example Pearson Education © 2009.
Section 10.5 The Dot Product
Human and Computer Interaction (H.C.I.) &Communication Skills
Presentation transcript:

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Appendix C Overview of the QBE (Query-By-Example) Language

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley QBE: A Query Language Based on Domain Calculus (Appendix C) QBE (Query-By-Example) is based on the idea of giving an example of a query using “example elements”, which are similar to domain variables. Notation: An example element stands for a domain variable and is specified as an example value preceded by the underscore character. P. (called P dot) operator (for “print”) is placed in those columns which are needed for the result of the query. A user may initially start giving actual values as examples, but later can get used to providing a minimum number of variables as example elements.

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley QBE: A Query Language Based on Domain Calculus (Appendix C) The language is very user-friendly, because it uses minimal syntax. QBE was fully developed further with facilities for grouping, aggregation, updating etc. and is shown to be equivalent to SQL. The language is available under QMF (Query Management Facility) of DB2 of IBM and has been used in various ways by other products like ACCESS of Microsoft, and PARADOX. For details, see Appendix C in the text.

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley QBE Examples QBE initially presents a relational schema as a “blank schema” in which the user fills in the query as an example. Following slides illustrate some queries.

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Example Schema as a QBE Query Interface

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley QBE Examples The following domain calculus query can be successively minimized by the user as shown in the following slides: Query : {uv | (  q) (  r) (  s) (  t) (  w) (  x) (  y) (  z) (EMPLOYEE(qrstuvwxyz) and q=‘John’ and r=‘B’ and s=‘Smith’)}

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Four Successive ways to specify a QBE Query

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley QBE Examples Specifying complex conditions in QBE: A technique called the “condition box” is used in QBE to state more involved Boolean expressions as conditions. The C.4(a) gives employees who work on either project 1 or 2, whereas the query in C.4(b) gives those who work on both the projects.

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Complex Conditions with and without a condition box as a part of QBE Query

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Handling AND conditions in a QBE Query

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley JOIN in QBE : Examples The join is simply accomplished by using the same example element (variable with underscore) in the columns being joined from different (or same as in C.5 (b)) relation. Note that the Result is set us as an independent table to show variables from multiple relations placed in the result.

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Performing Join with common example elements and use of a RESULT relation

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley AGGREGATION in QBE Aggregation is accomplished by using.CNT for count,.MAX,.MIN,.AVG for the corresponding aggregation functions Grouping is accomplished by.G operator. Condition Box may use conditions on groups (similar to HAVING clause in SQL – see Section 8.5.8)

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley AGGREGATION in QBE : Examples

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley NEGATION in QBE : Example

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley UPDATING in QBE : Examples