Query-By-Example Query-By-Example Ping Zhou 2008.3
Apr 01, 2015
Query-By-ExampleQuery-By-ExamplePing Zhou2008.3
Introduction to QBEIntroduction to QBEQuery-By-ExampleA high-level database
management languageAlternation to SQL for querying
relational databaseCan be translated to SQLDeveloped at IBM (M. Zloof)
◦Many Databases have QBE-like extension
Ping Zhou / CS 2310 Course Seminar 2
Why QBE?Why QBE?Convenient and unified way to
query, update, define and control database
Requires little knowledge to the user, minimizes the concepts user needs to learn
Simple yet wide coverage of transactions
Graphical and tabular interfacePing Zhou / CS 2310 Course Seminar 3
Basic ConceptsBasic ConceptsInstead of writing text SQL
commands…◦Programming is done within 2-D
“skeleton tables”◦Constant vs Variable
Ping Zhou / CS 2310 Course Seminar 4
Basic Queries (1)Basic Queries (1)
Print the names and ages of all sailors…
Variables that appear only once can be omitted
Shorthand to print all fields
Ping Zhou / CS 2310 Course Seminar 5
Basic Queries (2)Basic Queries (2)Selections – Place constant in
some field
Print all sailors with rating=10
Ping Zhou / CS 2310 Course Seminar 6
Ordering and GroupingOrdering and GroupingOrder the answer using AO
(ascending order) or DO (descending order)
Duplicate tuples can be eliminated by using UNO.
Ping Zhou / CS 2310 Course Seminar 7
Select tuples from two relations by placing same variable at join column
Queries Over Multiple Queries Over Multiple RelationsRelations
Find sailors who reserved a boat for 8/24/96, and who are older than 25.
Ping Zhou / CS 2310 Course Seminar 8
Select Using Condition Select Using Condition BoxBoxCondition box
◦ Express a condition involving two or more columns. E.g.: _R/_A > 0.2
◦ Express a condition involving aggregate operation on a group
◦ Express a condition involving AND and OR operators
Ping Zhou / CS 2310 Course Seminar 9
Unnamed ColumnsUnnamed ColumnsCreate unnamed column for display
Display fields from more than one tables
Ping Zhou / CS 2310 Course Seminar 10
Updating Tables using Updating Tables using QBE (1)QBE (1)Insertion, Deletion and Updating
are done in the same way in QBEInsertion
Ping Zhou / CS 2310 Course Seminar 11
Updating Tables using Updating Tables using QBE (2)QBE (2)Deleting
Updating
Ping Zhou / CS 2310 Course Seminar 12
Changes Brought by QBEChanges Brought by QBEUser Interface
◦Text command -> Graphical, Tabular◦User draw the table he wants
directlyEasier to learn
◦Higher scores than SQL users in paper and pencil testing
Ping Zhou / CS 2310 Course Seminar 13
QBE / OBEQBE / OBEOBE: Office Procedure by Example
◦ Incorporate QBE into office automation◦ Research project developed by IBM
Ping Zhou / CS 2310 Course Seminar 14
Spatial QBESpatial QBEAdding spatial extension to QBE
Retrieve all ATMs along Route 64
Retrieve all banks within 100 meters from Washington Hotel.
Ping Zhou / CS 2310 Course Seminar 15
Multimedia Queries with Multimedia Queries with QBEQBESimilarity function
Find all oil paintings from a Dutch painter which are similar to the given picture.
Ping Zhou / CS 2310 Course Seminar 16
ReferencesReferencesQuery-By-Example: a data base language, M.
Zloof, 1977Query-By-Example (QBE),
http://pages.cs.wisc.edu/~dbbook/openAccess/thirdEdition/qbe.pdf
A Human Factors Experimental Comparison of SQL and QBE, Minnie Yi-Miin Yen and Richard W. Scamell, 1993
Spatial QBE Interface for Web GIS, Shapiee Abd Rahman, Subhash Bhalla, 2005
WS-QBE: A QBE-like Query Language for Complex Multimedia Queries, Ingo Schmitt, Nadine Schulz, Thomas Herstel, 2005
Ping Zhou / CS 2310 Course Seminar 17
THANK YOU!THANK YOU!
Ping Zhou / CS 2310 Course Seminar 18