Access Queries Office 2013/365 1. Queries Most common type of Query is selection(projection) Specify sources for data retrieval table(s) and/or query(ies)

Slides:



Advertisements
Similar presentations
Working with Tables 1 of 5. Working with Tables 2 of 5.
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.
Exploring Microsoft Access
Concepts of Database Management Seventh Edition
Concepts of Database Management Sixth Edition
Concepts of Database Management Seventh Edition
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2: Relational Databases.
The University of Akron Dept of Business Technology Computer Information Systems The Relational Model: Query-By-Example (QBE) 2440: 180 Database Concepts.
Access Tutorial 3 Maintaining and 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.
Querying a Database Using the Select Query Window
Querying a Database Microsoft Office Access 2003.
1 Chapter 2 Reviewing Tables and Queries. 2 Chapter Objectives Identify the steps required to develop an Access application Specify the characteristics.
Concepts of Database Management Sixth Edition
Microsoft Access 2010 Chapter 7 Using SQL.
Chapter 2 Querying a Database
Chapter 3 Maintaining a Database
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 1 1. Chapter 2: Relational Databases and Multi-Table Queries Exploring Microsoft Office.
Concepts of Database Management, Fifth Edition
1 Microsoft Access 2002 Tutorial 3 – Querying a Database.
Chapter 2 Querying a Database MICROSOFT ACCESS 2010.
XP New Perspectives on Microsoft Access 2002 Tutorial 51 Microsoft Access 2002 Tutorial 5 – Enhancing a Table’s Design, and Creating Advanced Queries and.
SQL 資料庫查詢語言 取材自 EIS, 3 rd edition By Dunn et al..
Copyright © 2008 Pearson Prentice Hall. All rights reserved.1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2: Relational Databases.
Lesson 31: Querying a Database. 2 Learning Objectives After studying this lesson, you will be able to:  Create, save, and run select queries  Design.
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.
10/31/2012ISC239 Isabelle Bichindaritz1 SQL Graphical Queries Design Query By Example.
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.
© 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 6 – Designing.
Lesson 2.  To help ensure accurate data, rules that check entries against specified values can be applied to a field. A validation rule is applied to.
Inner Join vs. Outer Join
® 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.
Examining data using Microsoft Access Queries Using Criteria and Calculations SESSION 3.2 This section covers specifying an exact match condition in a.
Concepts of Database Management Seventh Edition
Concepts of Database Management Seventh Edition
Copyright © 2008 Pearson Prentice Hall. All rights reserved Committed to Shaping the Next Generation of IT Experts. Chapter 7 Advanced Queries Robert.
Database Systems Microsoft Access Practical #3 Queries Nos 215.
Chapter 9 Query-by-Example Pearson Education © 2009.
Access Project 3 Notes. Introduction Maintaining the Database  Modifying the data to keep it up-to-date Restructure the Database  To change the database.
SESSION 3.1 This section covers using the query window in design view to create a query and sorting & filtering data while in a datasheet view. Microsoft.
Part II. Query Types On the design query table pane, right click and the cascading window will appear.
MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing.
Chapter 3 Query and Report. Agenda Report types Report contents Report creation Report design view Query and dynaset Function and grouping Action query.
Course ILT Forms and queries Unit objectives Create forms by using AutoForm and the Form Wizard, and add or modify form headers and footers Open and enter.
® Microsoft Office 2013 Access Maintaining and Querying a Database.
1 DBS201: Introduction to Structure Query Language (SQL) Lecture 1.
XP New Perspectives on Microsoft Access 2002 Tutorial 31 Microsoft Access 2002 Tutorial 3 – Querying a Database.
A Guide to SQL, Eighth Edition Chapter Six Updating Data.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 5 1 Microsoft Office Access 2003 Tutorial 5 – Enhancing a Table’s Design.
Microsoft Access Lesson 5 Lexington Technology Center February 25, 2003 Bob Herring On the Web at
Lesson 4: Querying a Database. 2 Learning Objectives After studying this lesson, you will be able to:  Create, save, and run select queries  Set query.
A Guide to MySQL 6. 2 Objectives Create a new table from an existing table Change data using the UPDATE command Add new data using the INSERT command.
VOCAB REVIEW. A field that can be computed from other fields Calculated field Click for the answer Next Question.
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
1 11 Chapter 7 Action Queries Exploring Microsoft Office Access 2007.
Access Tutorial 3 Maintaining and Querying a Database
DATABASE CONCEPTS A database is a collection of logically related data designed to meet the information needs of one or more users Data bases are store-houses.
Objectives Create an action query to create a table
Access Maintaining and Querying a Database
Exploring Microsoft Office Access 2010
Database Queries.
Tutorial 3 – Querying a Database
Microsoft Office Access 2003
Chapter 9 Query-by-Example Pearson Education © 2009.
Query-by-Example Transparencies
Tutorial 9 Using Action Queries and Advanced Table Relationships
Presentation transcript:

Access Queries Office 2013/365 1

Queries Most common type of Query is selection(projection) Specify sources for data retrieval table(s) and/or query(ies) Specify attributes(fields) to be retrieved Selection criteria Calculations that need to be performed Action Queries Other types such as crosstabs 2

3 Query Creation Structured Query Language (SQL) The user enters commands according to a pre- defined syntax to retrieve desired data. Query By Example (QBE) The user starts with a sample of the table(s) columns and marks the fields he or she wants to include in the answer. Defaults are available for summarizing and manipulating the data.

Creating Queries Query Wizard QBE Query Design The user starts with a sample of the table(s) columns and marks the fields he or she wants to include in the answer. Defaults are available for summarizing and manipulating the data. SQL design (beyond scope of our class) The user enters commands according to a pre-defined syntax to retrieve desired data. 4

Creating Query Wizards Click on create tab Select query wizard Select simple query Select your data source(s) Select desired attributes from each data source Select next Name query Click on finish Limitation May be able to do a summary calculation, but not a calculated field 5

6 Wizard Click on create tab and select Query Wizard

7 Click on Simple Query wizard

8 Select data sources and desired attributes from each source

9 Name your query

10 Resulting Dynaset

Access creates the SQL needed to do the query for the wizard SQL for previous query example 11 SELECT Customers.[ID], Customers.[Last Name], Customers.[First Name], Customers.[ Address], Customers.[Job Title], Customers.[Business Phone] FROM Customers;

Design View Uses QBE (what we will use) Design View Click on create tab Select query design Select your data sources and click on add Select attributes from each data source and drag to grid below Run query Save query if it will be used on a regular basis Can create calculated fields 12

13 Click on create tab and select Query Design

14 Select your data sources and click on add

15 Select attributes from each data source and double click or drag to grid below

16 Select design tab and Click on Run symbol to execute query

17 Resulting Dynaset SQL SELECT Customers.[ID], Customers.[Last Name], Customers.[First Name], Customers.[ Address], Customers.[Job Title], Customers.[Business Phone] FROM Customers;

18 Examples to follow based on this database

19 Customer table data

Queries with selection criteria Use design view when using selection criteria Select your data sources and attributes of interest from your data sources enter selection criteria Run query 20

21 Selection Criteria Query to list Customers from CA

22 Resulting Dynaset SQL SELECT Customers.ID, Customers.Company, Customers.City, Customers.[State/Province] FROM Customers WHERE (((Customers.[State/Province])="CA"));

23 Queries (complex selection criteria) Comparison operators <, >, =, <=, >=, and <> Not equal to Logical operators And, Or, and Not

24 Multiple Criteria AND operator Queries that must satisfy more than one condition, with all conditions being true, use the AND operator OR operator When any one of several criteria is all that is required for a row to be displayed in a dynaset, then you use the OR operator

And Operator 25 Selection Criteria

Resulting Dynaset 26 SQL SELECT Customers.ID, Customers.Company, Customers.City FROM Customers WHERE (((Customers.City)="Los Angelas") AND ((Customers.[State/Province])="CA"));

OR Operator 27 Selection Criteria

28 Resulting Dynaset SQL SELECT Customers.ID, Customers.Company, Customers.City FROM Customers WHERE (((Customers.[State/Province])="CA")) OR (((Customers.[State/Province])="UT"));

29 Action queries Action Queries Make table Append update Delete Action queries alter information as opposed to selection queries, which passively display information without altering anything Back up data before performing action queries No undo

Action Queries Make Table Query selects records from data base and saves the records in a new table Append Make query add records to an existing table Update Make query update data in an existing table Delete Make the query delete the information from an existing table where the data matches the criteria 30

Action Queries Use design view to perform action queries Select create tab Query design Select data source(s) Select data and/or selection criteria Select design, select action query Save query Run query You will get a pop-up message indicating what the query is about to do 31

32 Depending on action query selected you need to specify fields and/or criteria Make table, Append, Update, Delete

Example Action query message 33

Example Action query message 34

Append Query Considerations Select the table containing the data you want to add Source may be internal or external Select the destination Fields must be of like data type Field mapping 35

36 Source Destination

37 Note: 1.Access has attempting to map the fields from tblCA to table customer 2.Access maps all fields between the two tables with the same field names

38 Note: 1.Since the two tables used a different names for this field, manual mapping required