Docsity

Query-By-Example - Data Base Management System - Lecture Slides, Slides of Database Management Systems (DBMS)

Partial preview of the text

Download Query-By-Example - Data Base Management System - Lecture Slides and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

Chapter 7

Query-By-Example

Structure of the chapter

7.1 Introduction to Microsoft Access Queries

7.2 Building Select Queries Using QBE

7.3 Using Advanced Queries

7.4 Changing the Content of Tables Using Action Queries

Objectives II

  • How to use QBE to target single or multiple tables.
  • How to perform calculations using QBE.
  • How to use advanced QBE facilities including parameter, find matched, find unmatched, crosstab, and autolookup queries.
  • How to use QBE action queries to change the content of tables.

QBE facilities

  • QBE was developed originally by IBM in 1970s to help users in their retrieval of data from a database
  • QBE is now provided by most popular Data Base Management Systems including Microsoft Access

Microsoft Access 2000

  • Many of the Microsoft Access SQL statements displayed in this chapter do not comply with the SQL standard presented in Chapters 5 and 6

7.1 Introduction to Microsoft Access

Queries

  • When we create or open a database using Microsoft Access, the Database window is displayed showing the objects such as tables, forms, queries, and reports in the database.

Introduction to Microsoft Access

Summary of Microsoft Access Query Types

Figure 7.2 Microsoft Access New Query dialog box

7.2 Building Select Qqueries Using QBE Select query

  • is the most common type of query
  • retrieves the data from one or more tables and displays the results in a datasheet (similar to a spreadsheet) where we can update and edit the records with some restrictions
  • can group records and calculate sums, counts, averages, and other types of total

Figure 7.3 (a) QBE grid to retrieve the propertyNo, city, type, and rent fields of the PropertyForRent table; (b) resulting datasheet; (c) equivalent SQL statement.

AND operator

If the expressions are in different cells in the same row, which means only the records that meet the criteria in all the cells will be returned.

OR operator

If the expressions are in different rows of the design grid, which means records that meet criteria in any of the cells will be returned.

Figure 7.5 (a) QBE grid of select query to retrieve the properties in Glasgow with a rent between £350 and £450 and all properties in Aberdeen; (b) resulting datasheet; (c) equivalent SQL statement. (^20)