The University of Akron Dept of Business Technology Computer Information Systems The Relational Model: Query-By-Example (QBE) 2440: 180 Database Concepts.

Slides:



Advertisements
Similar presentations
Relational Algebra, Join and QBE Yong Choi School of Business CSUB, Bakersfield.
Advertisements

© 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 10 – Designing.
Concepts of Database Management Seventh Edition
Concepts of Database Management Sixth Edition
Concepts of Database Management Seventh Edition
Exploring Microsoft Access 2003 Chapter 6 Many-to-Many Relationships: A More Complex System.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 3 1 Microsoft Office Access 2003 Tutorial 3 – Querying a Database.
XP Chapter 3 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Analyzing Data For Effective Decision Making.
With Microsoft ® Access 2010© 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access.
Querying a Database Microsoft Office Access 2003.
Chapter 2 Querying a Database
Concepts of Database Management Sixth Edition
A Guide to SQL, Seventh Edition. Objectives Retrieve data from a database using SQL commands Use compound conditions Use computed columns Use the SQL.
Microsoft Access 2010 Chapter 7 Using SQL.
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-1 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left,
Concepts of Database Management, Fifth Edition
1 Microsoft Access 2002 Tutorial 3 – Querying a Database.
Chapter 2 Querying a Database MICROSOFT ACCESS 2010.
Chapter 3 Single-Table Queries
Microsoft Access 2010 Chapter 7 Using SQL. Change the font or font size for SQL queries Create SQL queries Include fields in SQL queries Include simple.
With Microsoft Office 2007 Introductory© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Office 2007 Introductory.
CS&E 1111 AcQueries Querying in Access Sorting data Aggregating Data Performing Calculations Objectives: Learn how to use the Access Query Design Tool.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 4 BACKNEXTEND 4-1 LINKS TO OBJECTIVES Query Design Query Criteria Modify a Query Using OR.
1 Chapter 7 Query-By-Example by Monica Chan CS157B Professor Lee.
HAP 709 – Healthcare Databases SQL Data Manipulation Language (DML) Updated Fall, 2009.
 Continue queries ◦ You completed two tutorials with step-by-step instructions for creating queries in MS Access. ◦ Now must apply knowledge and skills.
10/31/2012ISC239 Isabelle Bichindaritz1 SQL Graphical Queries Design Query By Example.
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. Office Access 2003 Lab 3 Analyzing Data and Creating Reports.
Database Queries. Queries Queries are questions used to retrieve information from a database. Contain criteria to specify the records and fields to be.
Microsoft Access 2010 Building and Using Queries.
Analyzing Data For Effective Decision Making Chapter 3.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 9 1 Microsoft Office Access 2003 Tutorial 9 – Using Action Queries, and Defining Table Relationships.
® Microsoft Office 2010 Access Tutorial 3 Maintaining and Querying a Database.
MS-ACCESS BY SANGEETHA PARTHASARATHY Topics to be covered §Comparing Values in Selection Criteria §Calculating Values in a Query §Changing the appearance.
1 Single Table Queries. 2 Objectives  SELECT, WHERE  AND / OR / NOT conditions  Computed columns  LIKE, IN, BETWEEN operators  ORDER BY, GROUP BY,
Concepts of Database Management Seventh Edition
Using Special Operators (LIKE and IN)
Concepts of Database Management Seventh Edition
Querying a Database - A question or an inquiry (dictionary.com) - WHAT ARE WE ASKING QUESTIONS ABOUT? THE DATA - BY ASKING QUESTIONS OF THE DATA WE OBTAIN?
Chapter 9 Query-by-Example Pearson Education © 2009.
Querying a Database Access Project 2. 2 What is a Query?  In general, a query is a form of questioning, in a line of inquiry. A query may also refer.
XP Chapter 3 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Analyzing Data For Effective Decision Making Chapter.
Tutorial 9 Using Action Queries and Advanced Table Relationships.
Exploring Microsoft Access Chapter 6 Many-to-Many Relationships: A More Complex System.
Intro to SQL Management Studio. Please Be Sure!! Make sure that your access is read only. If it isn’t, you have the potential to change data within your.
Chapter 3 Query and Report. Agenda Report types Report contents Report creation Report design view Query and dynaset Function and grouping Action query.
Concepts of Database Management Eighth Edition Chapter 3 The Relational Model 2: SQL.
Database Applications – Microsoft Access Lesson 4 Working with Queries 36 Slides in Presentation.
Reports and Queries Chapter 3 – Access text Reports – Page Queries – Page
Concepts of Database Management Seventh Edition Chapter 3 The Relational Model 2: SQL.
XP New Perspectives on Microsoft Access 2002 Tutorial 31 Microsoft Access 2002 Tutorial 3 – Querying a Database.
1 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Chapter 2 The Relational Model 1: Introduction, QBE, and Relational Algebra.
© 2002 by Prentice Hall 1 Structured Query Language David M. Kroenke Database Concepts 1e Chapter 3 3.
A Guide to SQL, Eighth Edition Chapter Four Single-Table Queries.
1 SQL II CIS*2450 Advanced Programming Concepts. 2 Data Types INTEGER –numbers without a decimal point –range is to SMALLINT –like.
1 Chapter 3 Single Table Queries. 2 Simple Queries Query - a question represented in a way that the DBMS can understand Basic format SELECT-FROM Optional.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
Southern Methodist University CSE CSE 2337 Introduction to Data Management Chapter 2.
Chapter 6 Many-to Many Relationship. Agenda AutoNumber Many-to-many relationship Cascaded updating and deleting Auto Lookup Parameter query Total query.
VOCAB REVIEW. A field that can be computed from other fields Calculated field Click for the answer Next Question.
Computer Science & Engineering 2111 Inner Joins and Advanced Queries 1CSE 2111 Lecture-Advanced Queries.
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
Querying in Access Objectives: Learn how to use the Access Query Design Tool manipulate data in Access: Sorting data Aggregating Data Performing Calculations.
Microsoft Access 2003 Illustrated Complete
GO! with Microsoft® Access e
Database Queries.
Tutorial 3 – Querying a Database
Access Tutorial 5 Creating Advanced Queries and Enhancing Table Design
Access: Queries III Participation Project
Shelly Cashman: Microsoft Access 2016
Presentation transcript:

The University of Akron Dept of Business Technology Computer Information Systems The Relational Model: Query-By-Example (QBE) 2440: 180 Database Concepts Instructor: Enoch E. Damson

2The Relational Model: QBE Query-by-Example (QBE) Query Query Questions represented in a way the DBMS can recognize and process Questions represented in a way the DBMS can recognize and process QBE QBE Visual approach to writing queries Visual approach to writing queries Used in MS-Access Used in MS-Access

3The Relational Model: QBE Figure 2.3: An Example of Simple Queries

4The Relational Model: QBE Figure 2.4: Simple Queries…

5The Relational Model: QBE Simple Criteria Criteria – conditions that data must satisfy Criteria – conditions that data must satisfy Criterion – a single condition Criterion – a single condition To display specific query results, enter the condition in the appropriate column in the design grid To display specific query results, enter the condition in the appropriate column in the design grid

6The Relational Model: QBE Query with Simple Criteria

7The Relational Model: QBE Comparison (Relational) Operators Finds something other than an exact match Finds something other than an exact match Comparison operators are: Comparison operators are: = (equal to) = (equal to) > (greater than) > (greater than) < (less than) < (less than) >= (greater than or equal to) >= (greater than or equal to) <= (less than or equal to) <= (less than or equal to) NOT (not equal to) NOT (not equal to)

8The Relational Model: QBE Compound Criteria Combines comparison operators Combines comparison operators Many languages use AND or OR between the separate criteria Many languages use AND or OR between the separate criteria In an AND criterion, both criteria must be true In an AND criterion, both criteria must be true In an OR criterion, the overall criterion is true if either of the individual criteria is true In an OR criterion, the overall criterion is true if either of the individual criteria is true

9The Relational Model: QBE Query Using AND Criteria

10The Relational Model: QBE Query Using OR Criteria

11The Relational Model: QBE Computed Fields You can include calculated fields that are not in the database in queries You can include calculated fields that are not in the database in queries Computed field (calculated field) – a field that is the result of a calculation using one or more existing fields Computed field (calculated field) – a field that is the result of a calculation using one or more existing fields In a query that uses computed fields, if a field name contains spaces you must enclose it in square brackets In a query that uses computed fields, if a field name contains spaces you must enclose it in square brackets

12The Relational Model: QBE Query Using Computed Field

13The Relational Model: QBE Calculating Statistics Count Count Sum Sum Avg (average) Avg (average) Max (largest value) Max (largest value) Min (smallest value) Min (smallest value) StDev (standard deviation) Var (variance) First Last u Built-in statistics (called aggregate functions in Access) include:

14The Relational Model: QBE Query to Calculate an Average

15The Relational Model: QBE Grouping Grouping – creating groups of records that share some common characteristic Grouping – creating groups of records that share some common characteristic Functions can be used in combination with grouping where statistics are calculated for groups of records Functions can be used in combination with grouping where statistics are calculated for groups of records

16The Relational Model: QBE Sorting Sorting – listing records in a query’s results in a particular way Sorting – listing records in a query’s results in a particular way It is possible to sort using more than one field It is possible to sort using more than one field Sort Key – the field on which records are sorted Sort Key – the field on which records are sorted Major sort key (primary sort key) – the more important field Major sort key (primary sort key) – the more important field Minor sort key (secondary sort key) – the less important field Minor sort key (secondary sort key) – the less important field Major sort key is on the left of the grid and the minor sort key is on the right Major sort key is on the left of the grid and the minor sort key is on the right

17The Relational Model: QBE Query to Sort Records

18The Relational Model: QBE Query to Sort on Multiple Keys

19The Relational Model: QBE Query to Sort on Multiple Keys…

20The Relational Model: QBE Joining Tables Queries to select data from more than one table Queries to select data from more than one table Join the tables based on matching fields in corresponding columns Join the tables based on matching fields in corresponding columns In an Access query, a join line between matching fields in the two tables will be created indicating how the tables are related In an Access query, a join line between matching fields in the two tables will be created indicating how the tables are related When joining multiple tables When joining multiple tables Add all the tables involved to the upper pane Add all the tables involved to the upper pane Add the query results grid in the desired order Add the query results grid in the desired order

21The Relational Model: QBE Query to Join Table

22The Relational Model: QBE Query to Join Tables…

23The Relational Model: QBE Update Query Update query – a query that changes data Update query – a query that changes data Makes a specified change to all records satisfying the criteria in the query Makes a specified change to all records satisfying the criteria in the query In Access, a new row is created that is used to indicate how to update the data selected by the query In Access, a new row is created that is used to indicate how to update the data selected by the query

24The Relational Model: QBE Update Query

25The Relational Model: QBE Delete Query Queries can be used to delete one or more records at a time Queries can be used to delete one or more records at a time Delete query – deletes all the records satisfying the criteria entered into the query Delete query – deletes all the records satisfying the criteria entered into the query When you change the Query type to Delete Query, an extra row, called a Delete row, is added to the design grid When you change the Query type to Delete Query, an extra row, called a Delete row, is added to the design grid

26The Relational Model: QBE Delete Query

27The Relational Model: QBE Make-Table Query Queries can be used to create a new table in either the current database or in a separate database Queries can be used to create a new table in either the current database or in a separate database Make-table query – creates a new table using the query results Make-table query – creates a new table using the query results The data added to the new table is separate from the original table in which it appears The data added to the new table is separate from the original table in which it appears

28The Relational Model: QBE Make-Table Query

29The Relational Model: QBE Make-Table Query…