1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Access 2010 by Robert Grauer, Keith Mast, and Mary Anne.

Slides:



Advertisements
Similar presentations
Working with Tables 1 of 5. Working with Tables 2 of 5.
Advertisements

INSERT BOOK COVER 1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Excel 2010 by Robert Grauer, Keith.
Chapter 1 Getting Started with Access Databases. Objectives Identify Good Database Design Create a Table and Define Fields in a New Blank Database Change.
Copyright © 2008 Pearson Prentice Hall. All rights reserved Committed to Shaping the Next Generation of IT Experts. Exploring Microsoft Office Access.
With Microsoft Access 2010© 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access.
With Microsoft Access 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access.
With Microsoft Access 2010© 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access.
By Mary Anne Poatsy, Keith Mulbery, Eric Cameron, Jason Davidson, Rebecca Lawson, Linda Lau, Jerri Williams Chapter 7 Advanced Forms and Reports 1 Copyright.
INSERT BOOK COVER 1Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Access 2010 by Robert Grauer, Keith Mast,
By Mary Anne Poatsy, Keith Mulbery, Eric Cameron, Jason Davidson, Rebecca Lawson, Linda Lau, Jerri Williams Chapter 9 Fine-Tuning the Database 1 Copyright.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2: Relational Databases.
By Mary Anne Poatsy, Keith Mulbery, Eric Cameron, Jason Davidson, Rebecca Lawson, Linda Lau, Jerri Williams Chapter 8 Get Connected 1 Copyright © 2014.
By Mary Anne Poatsy, Keith Mulbery, Eric Cameron, Jason Davidson, Rebecca Lawson, Linda Lau, Jerri Williams Chapter 5 Data Validation and Data Analysis.
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.
With Microsoft ® Access 2010© 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access.
With Microsoft Access 2010© 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access.
By Mary Anne Poatsy, Keith Mulbery, Eric Cameron, Jason Davidson, Rebecca Lawson, Linda Lau, Jerri Williams Chapter 10 Using Macros and SQL in Access 1.
With Microsoft Access 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access.
With Microsoft Access 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access.
Getting Started with Microsoft Access The Access Workbench: Section One DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 4 th Edition.
Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall. 1 by Mary Anne Poatsy, Keith Mulbery, Lynn Hogan, Amy Rutledge, Cyndi Krebs, Eric.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 11 Copyright © 2008 Prentice-Hall. All rights reserved. Committed to Shaping the Next.
1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Word 2010 by Robert Grauer, Michelle Hulett, and Mary.
INSERT BOOK COVER 1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Excel 2010 by Robert Grauer, Keith.
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,
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 1 1. Chapter 2: Relational Databases and Multi-Table Queries Exploring Microsoft Office.
INSERT BOOK COVER 1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Excel 2010 by Robert Grauer, Keith.
Copyright © 2008 Pearson Prentice Hall. All rights reserved.1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2: Relational Databases.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2: Relational.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall1 Exploring Microsoft Office Access Committed to Shaping the Next Generation.
1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Access 2010 by Robert Grauer, Keith Mast, and Mary Anne.
INSERT BOOK COVER 1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Access 2010 by Robert Grauer, Keith.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 1 Committed to Shaping the Next Generation of IT Experts. Chapter 1: Finding Your.
1 Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall. by Mary Anne Poatsy, Keith Mulbery, Lynn Hogan, Amy Rutledge, Cyndi Krebs, Eric.
1 Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall. Access Module 1 Workshop 1 The Four Main Database Objects Series Editor Amy Kinser.
1 Chapter 7 Query-By-Example by Monica Chan CS157B Professor Lee.
1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Access 2010 by Robert Grauer, Keith Mast, Mary Anne Poatsy Chapter.
INSERT BOOK COVER 1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Access 2010 by Robert Grauer, Keith Mast,
Analyzing Data For Effective Decision Making Chapter 3.
1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Access 2010 by Robert Grauer, Keith Mast, and Mary Anne.
INSERT BOOK COVER 1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Excel 2010 by Robert Grauer, Keith.
INSERT BOOK COVER 1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Access 2010 by Robert Grauer, Keith.
1 Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall. by Mary Anne Poatsy, Keith Mulbery, Lynn Hogan, Amy Rutledge, Cyndi Krebs, Eric.
1 Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall. Access Module 1 Workshop 2 Tables, Keys, and Relationships Series Editor Amy Kinser.
GO! with Office 2013 Volume 1 By: Shelley Gaskin, Alicia Vargas, and Carolyn McLellan Access Chapter 3 Forms, Filters, and Reports.
Microsoft Office 2007 Intermediate© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! With Microsoft ® Office 2007 Intermediate Chapter.
Copyright © 2008 Pearson Prentice Hall. All rights reserved Committed to Shaping the Next Generation of IT Experts. Chapter 7 Advanced Queries Robert.
1 Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall. Access Module 2 Workshop 3 Queries and Data Access Series Editor Amy Kinser by.
1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Access 2010 by Robert Grauer, Keith Mast, Mary Anne Poatsy Chapter.
Database Applications – Microsoft Access Lesson 4 Working with Queries 36 Slides in Presentation.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 11 Committed to Shaping the Next Generation of IT Experts. Chapter 3: Customize, Analyze,
1 Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall. by Mary Anne Poatsy, Keith Mulbery, Lynn Hogan, Amy Rutledge, Cyndi Krebs, Eric.
INSERT BOOK COVER 1Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Getting Started with VBA for Microsoft Office 2010 by.
1 Exploring Microsoft Office Excel 2010 by Robert Grauer, Keith Mulbery, and Mary Anne Poatsy Chapter 4 Excel Datasets and Tables Copyright © 2011 Pearson.
1 Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall. by Mary Anne Poatsy, Keith Mulbery, Eric Cameron, Jason Davidson, Rebecca Lawson,
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 4: Create, Edit,
Skills for Success with Microsoft Office 2013 Volume 1 Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall. by Kris Townsend, Catherine.
INSERT BOOK COVER 1Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Getting Started with VBA for Microsoft Office 2010 by.
1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Access 2010 by Robert Grauer, Keith Mast, and Mary Anne.
By Mary Anne Poatsy, Keith Mulbery, Eric Cameron, Jason Davidson, Rebecca Lawson, Linda Lau, Jerri Williams Chapter 6 Action and Specialized Queries 1.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall. 1 Skills for Success with Microsoft ® Office 2007 PowerPoint Lecture to Accompany.
1 11 Chapter 7 Action Queries Exploring Microsoft Office Access 2007.
Exploring Microsoft Office Access 2007
GO! with Microsoft Office 2016
GO! with Microsoft Access 2016
Exploring Microsoft Office Access 2010
GO! with Microsoft® Access e
Excel Datasets and Tables
Exploring Microsoft® Access® 2016 Series Editor Mary Anne Poatsy
Presentation transcript:

1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Access 2010 by Robert Grauer, Keith Mast, and Mary Anne Poatsy Chapter 7 Advanced Queries: Moving Beyond the Select Query

Objectives Determine when to use an action query Update data with an update query Add records to a table with an append query Create a table with a make table query Delete records with a delete query Create a parameter query to provide flexibility Summarize data with a crosstab query Find unmatched records with a query Find duplicate records with a query Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 2

Action Queries Alternative to the Select query, which fetches information for display Will perform an action to change data Start by making Select query, and then change type to: – Update – Append – Make table – Delete Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 3

Action Queries Can use criteria just as Select queries can Often run in the background (not always on command) Can cause problems with data loss Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 4

Action Queries: Examples Append query — used to copy records to an existing table – Example: Copy graduated students from Students table to Graduated table in a student database Delete query — used to remove records – Example: Delete graduated students from Students table after they are copied to Graduated table No “move” query; this is how we simulate a move Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 5

Action Queries: Examples Update query — used to make changes – Example: One customer service rep leaves, and all clients assigned to that rep must be changed to someone else Make table query — used to copy information to a new table – Example: Move all inactive customers to a new table – Pair with delete query to remove old records – Can help keep Customers table fast and efficient Queries on smaller tables will be quicker Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 6

Action Queries: Locations Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 7 Make Table Append Update Delete Locations of Action Queries on Query Tools Design Tab

Action Queries: Warnings Important to backup database first – Can make changes that cause unintended changes Access prompts with the number of records to change – Ensure number sounds correct Verify table data afterwards – Did it change what you thought it would change? Do not re-run – Especially with Update queries, updates that are calculations can cause unintended changes Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 8

Update Query Used to automate changes to a database – No need to do by hand Change the value of one or more fields automatically Can be based on criteria (single or multiple) Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 9

Update Query: Examples All athletes with grade point averages greater than 2.5 should have the Eligible field set to Yes West Paterson, NJ changed their name to Woodland Park – All customers who have a City field of West Paterson and a State of NJ should have the City field changed to Woodland Park Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 10

Append Query Selects records from one or more tables and adds them to existing table Destination table must exist – If not, use a Make Table query Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 11

Append Query Must match source fields with destination fields Data types must match – Cannot append a date field in to a numeric field – Exceptions: Numeric and Date fields can both be appended to a Text field Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 12

Append Query Validation rules in the destination table still apply – Could not duplicate primary key Any non-required, missing fields will be blank – If you append four fields to a five-field table, fifth field will be blank Destination table should NOT contain an Autonumber Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 13

Make Table Query Selects records from one or more tables Uses results to create a new table – Similar to append query, except results go to new table – Avoids issues with having to match data types If destination table exists, Access will prompt you to delete the existing table Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 14

Delete Query Selects records and then removes them from a table Permanently removes records – Use with caution – Backup database first May be done after a Make Table or Append query to simulate a move Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 15

Delete Query You need to know the following to create a Delete query: – What are the criteria that should be met for to records to be deleted Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 16

Queries for Special Conditions Other queries that can help a user make decisions: – Parameter query – Crosstab query – Find Unmatched Records query – Find Duplicate Records query Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 17

Queries for Special Conditions Parameter query – Will prompt the user for criteria Example: Prompt user to enter a state, return all customers living in that state Crosstab query – Similar to PivotTable – Displays aggregate data across two dimensions Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 18

Queries for Special Conditions Find Unmatched Records query – Example: Finds child records with no matching parent records In a one-to-many relationship, the “one” is the parent record and the “many” is the child record In an Orders database, if one customer places many orders, customer is the parent record and an order is the child record Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 19

Queries for Special Conditions Find Duplicate Records query – Can analyze data to find repeated information – Can find accidental replication of data Example: Customers can sign up for supermarket store cards, to find people who have signed up for two you can find people with the same name, address, etc. Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 20

Parameter Query Create regular Select query Add prompt to Criteria line, surrounded by brackets [Instructions] User will be prompted with your Instructions text and given a dialog box to enter data If multiple parameters exist, Access will start from the leftmost field and move right Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 21

Parameter Query Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 22 Access will prompt the user to fill in a value for the parameter in a dialog box when the query is executed. The parameter in this example is in brackets (as required).

Parameter Query Can be used for partial matches as well Example: Area Code – Prompt user for an area code – Return all phone numbers in that area code – Enter criteria as Like [Enter Area Code] & '*' – Results will be all phone numbers starting with entered data Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 23

Parameter Reports Reports can be based on queries To create a Parameter Report, create a Parameter query and then base the report on the query Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 24

Crosstab Query Summarizes a data source to a grid of rows and columns Uses aggregate functions to summarize data (sum, count, average, etc) Resembles PivotTable without filters Advantages: – Source can be tables, queries, or a combination of both – Can create many of them and save them Each table can only have one PivotTable Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 25

Crosstab Query Column headings display field values along the top side Row headings display field values along the left side Once completed, it can be edited easily to add fields, change order, etc. Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 26

Crosstab Query: Example Example: – We want to summarize the revenue generated by each salesperson – We want to see totals for each month – We also want to see totals for the entire year Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 27

Crosstab Query Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 28 Two row headings exist: Last Name and First Name The months of the year are the column headings Aggregate function results show here

Find Unmatched Records Query Compares records in two related tables and displays the records found in one table, but not the other Requires a common field Example: Find all applicants to a college (stored in Student table) who have never registered for a class (found in Registration table) Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 29

Find Duplicate Records Query Useful to find duplicate values in a table Can be useful if there may be duplication of fields that should not exist – Want to add a primary key field – Duplicates exist, so primary key can not be added – Use query to find these duplicates Will find duplicates, but it is still up to DBA to review manually Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 30

Summary In this chapter, you learned to go beyond the Select query to automatically add, update, and delete records using other types of queries, and to use special types of queries to help make decisions and increase the flexibility of your database. Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 31

Questions Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 32

Copyright Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. 33 All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. Printed in the United States of America.