SQL Graphical Queries Design Query By Example 10/31/2012 ISC239 Isabelle Bichindaritz 1 Learning Objectives • Create queries with graphical design in Access. • List the main features of Query-By-Example (QBE). • List the types of queries provided by the Microsoft Access DBMS QBE facility. • Use QBE to build queries to select fields and records. • Use QBE to target single or multiple tables. 10/31/2012 ISC239 Isabelle Bichindaritz 2 Query Design Opening 10/31/2012 ISC239 Isabelle Bichindaritz 3 10/31/2012 ISC239 Isabelle Bichindaritz 4 10/31/2012 ISC239 Isabelle Bichindaritz 5 10/31/2012 ISC239 Isabelle Bichindaritz 6 Query Design Add tables Create joins Select fields Sort order Criteria Totals (aggregate operations) 10/31/2012 ISC239 Isabelle Bichindaritz 7 Adding Tables Right mouse button: add a table 10/31/2012 ISC239 Isabelle Bichindaritz 8 Creating Joins With the mouse create a join Ex : [Stay1].[InstitutionID] and [InstitutionID] 10/31/2012 ISC239 Isabelle Bichindaritz 9 Creating Joins 10/31/2012 ISC239 Isabelle Bichindaritz 10 Selecting Fields Name of selected field Name of the table Check to display field 10/31/2012 ISC239 Isabelle Bichindaritz 11 Sort order, Criteria Selection criteria 10/31/2012 Sort order ISC239 Isabelle Bichindaritz 12 Totals Right mouse button: Add one lign of work called totals 10/31/2012 ISC239 Isabelle Bichindaritz 13 Totals row Group by Totals choice: Group by Drop down list of totals 10/31/2012 ISC239 Isabelle Bichindaritz 14 Choice of total: Count 10/31/2012 Count and Where Choice of total: Where ISC239 Isabelle Bichindaritz 15 Query-by-Example (QBE) • Visual approach for accessing information in a database through use of query templates. • Example values are entered into template to represent what access to database is to achieve, such as the answer to a query. • Originally developed by IBM in 1970s and has proved so popular that QBE (or similar) is now provided by most DBMSs. • When user constructs a QBE - in background, DBMS creates an equivalent SQL statement. 16 10/31/2012 ISC239 Isabelle Bichindaritz Query-by-Example (QBE) • Allows user to: - Ask questions about data in one or more tables. - Specify the fields we want in the answer. - Select records according to some criteria. - Perform calculations on the data in tables. - Insert and delete records. - Modify values of fields. - Create new fields and tables. 17 10/31/2012 ISC239 Isabelle Bichindaritz QBE in Microsoft Access 18 10/31/2012 ISC239 Isabelle Bichindaritz Summary of Microsoft Access Query Types 19 10/31/2012 ISC239 Isabelle Bichindaritz Building Select Queries using QBE - Specifying Criteria 20 10/31/2012 ISC239 Isabelle Bichindaritz Building Select Queries using QBE - Specifying Criteria 21 10/31/2012 ISC239 Isabelle Bichindaritz Building Select Queries using QBE - Specifying Criteria 22 10/31/2012 ISC239 Isabelle Bichindaritz Creating Multi-table Queries 23 10/31/2012 ISC239 Isabelle Bichindaritz Calculating Totals 24 10/31/2012 ISC239 Isabelle Bichindaritz Calculating Totals 25 10/31/2012 ISC239 Isabelle Bichindaritz Using Advanced Queries Parameter Query 26 10/31/2012 ISC239 Isabelle Bichindaritz Using Advanced Queries Crosstab Query 27 10/31/2012 ISC239 Isabelle Bichindaritz Using Advanced Queries Crosstab Query 28 10/31/2012 ISC239 Isabelle Bichindaritz Using Advanced Queries - Find Matched Query 29 10/31/2012 ISC239 Isabelle Bichindaritz Using Advanced Queries - Find Unmatched Query 30 10/31/2012 ISC239 Isabelle Bichindaritz Using Advanced Queries Autolookup Query 31 10/31/2012 ISC239 Isabelle Bichindaritz Changing Content of Tables Make-Table Action Query 32 10/31/2012 ISC239 Isabelle Bichindaritz Changing Content of Tables Delete Action Query 33 10/31/2012 ISC239 Isabelle Bichindaritz Changing Content of Tables Update Action Query 34 10/31/2012 ISC239 Isabelle Bichindaritz Changing Content of Tables Append Action Query 35 10/31/2012 ISC239 Isabelle Bichindaritz Changing Content of Tables Append Action Query 36 10/31/2012 ISC239 Isabelle Bichindaritz
© Copyright 2026 Paperzz