DB Implementation: MS Access Queries. MS Access Queries Database Queries Core DBA skill From SQL to Query by Example (QBE) What does it do? Find target.

Slides:



Advertisements
Similar presentations
Exploring Microsoft Access
Advertisements

Concepts of Database Management Seventh Edition
Concepts of Database Management Sixth Edition
Concepts of Database Management Seventh Edition
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
FIS 318/618: Financial Systems & Databases Queries Oakland University School of Business Administration Accounting and Finance Joe Callaghan.
1 DB Implementation: MS Access Queries. 2 Outline Access Queries ► Query Creation ► Sorting & Filtering ► Query Types ► Dynamic Query.
Mary K. Olson PS Reporting Instance – Query Tool 101.
Microsoft Access 2010 Chapter 7 Using SQL.
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
Chapter 2 Querying a Database
Chapter 3 Maintaining a Database
Maintaining and Querying a Database Microsoft Access 2010.
DAY 16: ACCESS CHAPTER 2 Tazin Afrin October 10,
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,
© Paradigm Publishing, Inc Access 2010 Level 2 Unit 1Advanced Tables, Relationships, Queries, and Forms Chapter 3Advanced Query Techniques.
Concepts of Database Management, Fifth Edition
Chapter 2 Querying a Database MICROSOFT ACCESS 2010.
Lesson 31: Querying a Database. 2 Learning Objectives After studying this lesson, you will be able to:  Create, save, and run select queries  Design.
CS&E 1111 AcQueries Querying in Access Sorting data Aggregating Data Performing Calculations Objectives: Learn how to use the Access Query Design Tool.
Microsoft Access Intro Class 5 Working with Queries.
1 Chapter 7 Query-By-Example by Monica Chan CS157B Professor Lee.
HAP 709 – Healthcare Databases SQL Data Manipulation Language (DML) Updated Fall, 2009.
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. Office Access 2003 Lab 3 Analyzing Data and Creating Reports.
CSS/417 Introduction to Database Management Systems Workshop 2.
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.
® Microsoft Office 2010 Access Tutorial 3 Maintaining and Querying a Database.
Concepts of Database Management Seventh Edition
L546 Session 7, IU-SLIS 1 DB Implementation: MS Access Queries & Reports.
Exploring Office Grauer and Barber 1 Committed to Shaping the Next Generation of IT Experts. Chapter 3 - Information From the Database: Reports.
 Agenda 2/20/13 o Review quiz, answer questions o Review database design exercises from 2/13 o Create relationships through “Lookup tables” o Discuss.
Copyright 2008 McGraw-Hill Ryerson 1 TECHNOLOGY PLUG-IN T7 PROBLEM SOLVING USING ACCESS.
Filtering Data A filter is a set of restrictions you place on the records of an open datasheet or form to temporarily isolate a subset of the records.
A lesson approach © 2011 The McGraw-Hill Companies, Inc. All rights reserved. a lesson approach Microsoft® Excel 2010 © 2011 The McGraw-Hill Companies,
® Microsoft Access 2010 Tutorial 3 Maintaining and Querying a Database.
COMPREHENSIVE Access Tutorial 3 Maintaining and Querying a Database.
Chapter 3 Query and Report. Agenda Report types Report contents Report creation Report design view Query and dynaset Function and grouping Action query.
® Microsoft Office 2013 Access Maintaining and Querying a Database.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T7: Problem Solving Using Access 2007 Business Driven Technology.
Reports and Queries Chapter 3 – Access text Reports – Page Queries – Page
What are queries? Queries are a way of searching for and compiling data from one or more tables. Running a query is like asking a detailed question of.
The Advantage Series © 2004 The McGraw-Hill Companies, Inc. All rights reserved Creating Select Queries Chapter 6 Microsoft Office Access 2003.
T7-1 LEARNING OUTCOMES – ACCESS PROBLEM SOLVING 1.Describe the process of using the Simple Query Wizard using Access 2.Describe the process of using the.
Access Queries Agenda 6/16/14 Review Access Project Part 1, answer questions Discuss queries: Turning data stored in a database into information for decision.
(SQL - Structured Query Language)
Microsoft® Excel Create an Excel table. 1 Work with the Table Tools Design tab. 2 Sort and filter records in a table. 3 Identify structured references.
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.
Paul A. Harris, Ph.D. Director, GCRC Informatics How to use query function in Microsoft Access.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T7: Problem Solving Using Access 2007 Business Driven Technology.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
Access Maintaining and Querying a Database
Queries.
Microsoft Office Illustrated Introductory, Windows Vista Edition
Plug-In T7: Problem Solving Using Access 2007
Microsoft Access 2003 Illustrated Complete
Building and Using Queries
DB Implementation: MS Access Queries
DB Implementation: MS Access Queries
DB Implementation: MS Access Queries
DB Implementation: MS Access Queries
Microsoft Office Illustrated Introductory, Windows XP Edition
Chapter 3 Query and Report.
Tutorial 9 Using Action Queries and Advanced Table Relationships
Presentation transcript:

DB Implementation: MS Access Queries

MS Access Queries Database Queries Core DBA skill From SQL to Query by Example (QBE) What does it do? Find target information Retrieve, Filter, Sort, Aggregate/Summarize Manipulate data Perform calculations Add, Change, Delete, Combine data in tables Assemble/Supply data for forms and reports How does it work? Access translates QBE to SQL SQL performs data manipulations based on Relational Algebra Access queries create a dynaset (“live” view of table) changes made in data by query is reflected in underlying tables Database System2

Access Queries: Views Datasheet view For displaying the result of the query Useful for reviewing/validating the query Design View For creating/modifying a query using drag & drop GUI (i.e., QBE) Consists of Diagram Pane & Grid Pane Add tables/queries to the Diagram Pane Add fields to the Grid Pane (Field row) Can sort/filter/compute by fields Sort row: set to Ascending/Descending Criteria row: use Expression to apply data filter Total row: compute (sum, min, max, count, etc.) of each field Automatically generates SQL statements SQL View For creating/modifying a query by manually writing SQL statements Only way to create SQL-specific queries Union/Data-definition/Pass-through query Database System3

Access Queries: Basic Types Simple Query Uses one table/query To generate a subset (row/column) of a table Multi-table Query Joins multiple tables/queries To merge small chunks of data in normalized tables Linked tables are automatically linked in in the Query Design Grid Creating a link in the Query Design Grid does not permanently link tables Select Query Selects records that meet given criteria Does not change the data Parameter Query Prompts for query criteria values (parameters) to run a dynamic query Database System4

Access Queries: Sort & Filter Datasheet View Sorting Click column and right-click Filtering Filter Tool (Home tab) – Filter by Selection – Filter by Form – Advanced Filter/Sort Design View Sort using the Sort Row Sort priority is from left to right for multiple sort Filter using the Criteria Row Criteria in multiple rows make OR query Criteria in single row make AND query Criteria in a single cell – AND/OR – Wildcards (*) in Like and Between » e.g. Like “A*”, Like “[A-C]*”, Like “*av*”, Like “ave?”, Not Like “A*” » e.g. Between 1950 and 1960, >1960 Database System5

Access Queries: Query Criteria Query Criteria Expressions Database System6 ExpressionReturns Between #1/1/99# and #12/31/99# Dates from 1/1/99 to 12/31/99 In (“John”,”Mary”,”James”)Records with John, Mary, or James Is NullRecords with no entry Like “Acc?ss”‘Acc’ followed by any character, followed by ‘ss’ Like “*s”Ends in ‘s’ Like “v*”Starts with ‘v’ <1000Less than Equal to 1000 Like “[A-C]??”Starts with A through C and has two more characters ????Any four characters Len([Surname])= Val(4)Any Surname of 4 characters Right([Surname],2)= “ss”Any Surname ending in “ss” Left([Surname],2)= “ac”Any Surname starting with “ac”

Access Queries: Expressions Using expressions to create a calculated column Enter expressions in blank column of query design view NAME: [Field1] operator [Field2] Format the display in Format property of the field Examples Simple math DiscountPrice: [Discount] * [StandardPrice] String Concatenation Name: [FirstName] & “ ” & [Lastname] Date & Time math DateDiff(Interval, BeginDate, EndDate) – HireAge: DateDiff(“yyyy”,[BirthDate],[HireDate]) DateAdd(Interval, Number, Date) – RetireDate: DateAdd(“yyyy”,25,[HireDate]) Customized Sorting Switch(expr1, value1, expr2, value2, etc.) – Switch([City]=“Seatle”, 1, [City]=“Redmond”, 2, etc.) Database System7

Access Queries: Dynamic Criteria Parameterized Queries Dynamic query based on varying criteria value e.g. retrieve books written by a given author Enter the parameter name in square brackets in criteria Do not use existing field names Can use expressions – e.g. Like "*" & [Last Name] & "*“ Query Criteria from Form Entries Use a form to enter query parameter values good for multiple parameter entries 1.Create a parameter query 2.Create a form with unbound input control for each of query parameters 3.Add a command button that will run the parameter query Run Query Action of Miscellaneous Category 4.Reference the form controls that hold parameter values from the query i.e. change the criteria to form controls Parameter name = fully qualified name of form control Database System8

Access Queries: Joins Inner Join Default join in Access (i.e. Natural Join) Returns only the records where joined fields are equal in both tables Left Outer join Returns all records from the left table Right Outer join Returns all records from the right table Database System9