query-by-example ping zhou 2008.3. introduction to qbe query-by-example a high-level database...

18
Query-By-Example Query-By-Example Ping Zhou 2008.3

Upload: tanner-haldane

Post on 01-Apr-2015

229 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Query-By-Example Ping Zhou 2008.3. Introduction to QBE Query-By-Example A high-level database management language Alternation to SQL for querying relational

Query-By-ExampleQuery-By-ExamplePing Zhou2008.3

Page 2: Query-By-Example Ping Zhou 2008.3. Introduction to QBE Query-By-Example A high-level database management language Alternation to SQL for querying relational

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

Page 3: Query-By-Example Ping Zhou 2008.3. Introduction to QBE Query-By-Example A high-level database management language Alternation to SQL for querying relational

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

Page 4: Query-By-Example Ping Zhou 2008.3. Introduction to QBE Query-By-Example A high-level database management language Alternation to SQL for querying relational

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

Page 5: Query-By-Example Ping Zhou 2008.3. Introduction to QBE Query-By-Example A high-level database management language Alternation to SQL for querying relational

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

Page 6: Query-By-Example Ping Zhou 2008.3. Introduction to QBE Query-By-Example A high-level database management language Alternation to SQL for querying relational

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

Page 7: Query-By-Example Ping Zhou 2008.3. Introduction to QBE Query-By-Example A high-level database management language Alternation to SQL for querying relational

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

Page 8: Query-By-Example Ping Zhou 2008.3. Introduction to QBE Query-By-Example A high-level database management language Alternation to SQL for querying relational

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

Page 9: Query-By-Example Ping Zhou 2008.3. Introduction to QBE Query-By-Example A high-level database management language Alternation to SQL for querying relational

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

Page 10: Query-By-Example Ping Zhou 2008.3. Introduction to QBE Query-By-Example A high-level database management language Alternation to SQL for querying relational

Unnamed ColumnsUnnamed ColumnsCreate unnamed column for display

Display fields from more than one tables

Ping Zhou / CS 2310 Course Seminar 10

Page 11: Query-By-Example Ping Zhou 2008.3. Introduction to QBE Query-By-Example A high-level database management language Alternation to SQL for querying relational

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

Page 12: Query-By-Example Ping Zhou 2008.3. Introduction to QBE Query-By-Example A high-level database management language Alternation to SQL for querying relational

Updating Tables using Updating Tables using QBE (2)QBE (2)Deleting

Updating

Ping Zhou / CS 2310 Course Seminar 12

Page 13: Query-By-Example Ping Zhou 2008.3. Introduction to QBE Query-By-Example A high-level database management language Alternation to SQL for querying relational

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

Page 14: Query-By-Example Ping Zhou 2008.3. Introduction to QBE Query-By-Example A high-level database management language Alternation to SQL for querying relational

QBE / OBEQBE / OBEOBE: Office Procedure by Example

◦ Incorporate QBE into office automation◦ Research project developed by IBM

Ping Zhou / CS 2310 Course Seminar 14

Page 15: Query-By-Example Ping Zhou 2008.3. Introduction to QBE Query-By-Example A high-level database management language Alternation to SQL for querying relational

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

Page 16: Query-By-Example Ping Zhou 2008.3. Introduction to QBE Query-By-Example A high-level database management language Alternation to SQL for querying relational

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

Page 17: Query-By-Example Ping Zhou 2008.3. Introduction to QBE Query-By-Example A high-level database management language Alternation to SQL for querying relational

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

Page 18: Query-By-Example Ping Zhou 2008.3. Introduction to QBE Query-By-Example A high-level database management language Alternation to SQL for querying relational

THANK YOU!THANK YOU!

Ping Zhou / CS 2310 Course Seminar 18