DB Implementation: MS Access Queries

Slides:



Advertisements
Similar presentations
With Microsoft Access 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access.
Advertisements

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.
Query in Microsoft Access. Lesson plan Expression in Microsoft Access Create a query.
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.
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.
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.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 1 1. Chapter 2: Relational Databases and Multi-Table Queries Exploring Microsoft Office.
Chapter 2 Querying a Database MICROSOFT ACCESS 2010.
Copyright © 2008 Pearson Prentice Hall. All rights reserved.1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2: Relational Databases.
Microsoft Access Intro Class 5 Working with Queries.
Queries. What is a query? A query is actually the name for any database manipulation operation. The most commonly used type is a select query, which is.
Microsoft Access Queries Birgül Kutlu. SORTING AND FILTERING Sorting and filtering allow you to view records in a table in different ways such as: reordering.
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. Office Access 2003 Lab 3 Analyzing Data and Creating Reports.
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.
L546 Session 7, IU-SLIS 1 DB Implementation: MS Access Queries & Reports.
® Microsoft Access 2010 Tutorial 9 Using Action Queries and Advanced Table Relationships.
Part II. Query Types On the design query table pane, right click and the cascading window will appear.
Tutorial 9 Using Action Queries and Advanced Table Relationships.
® Microsoft Access 2010 Tutorial 3 Maintaining and Querying a Database.
MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing.
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 The O’Leary Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Access 2002 Lab 3 Analyzing Tables and Creating.
© 2001 ComputerPREP, Inc. All rights reserved. Access 2000: Module II.
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.
® Microsoft Access 2010 Tutorial 9 Using Action Queries and Advanced Table Relationships.
® Microsoft Access 2010 Tutorial 9 Using Action Queries and Advanced Table Relationships.
Relational Databases Today we will look at: Different ways of searching a database Creating queries Aggregate Queries More complex queries involving different.
DB Implementation: MS Access Forms. MS Access Forms: Purpose Data entry, editing, & viewing data in Tables Forms are user-friendlier to end-users than.
MS Access Forms, Queries, Reports Matt Martin
Access Maintaining and Querying a Database
Queries.
Microsoft Office Illustrated Introductory, Windows Vista Edition
Access Tutorial 3 Maintaining and Querying a Database
Objectives Query for top values Create a parameter query
Plug-In T7: Problem Solving Using Access 2007
Objectives Create an action query to create a table
Microsoft Access 2003 Illustrated Complete
Building and Using Queries
DB Implementation: MS Access Forms
Microsoft Office Access 2003
DB Implementation: MS Access Queries
Analyzing Data and Creating Reports
Creating and Modifying Queries
Tutorial 3 – Querying a Database
DB Implementation: MS Access Queries
Exploring Microsoft Access 2003
Microsoft Office Access 2003
Review: ACCESS Database Systems
DB Implementation: MS Access Forms
DB Implementation: MS Access Queries
Introduction to Access
Microsoft Office Illustrated Introductory, Windows XP Edition
Chapter 3 Query and Report.
Tutorial 9 Using Action Queries and Advanced Table Relationships
Assignment 3 Querying and Maintaining a Database
New Perspectives on Microsoft
Presentation transcript:

DB Implementation: MS Access Queries

MS Access Queries Database Queries What does it do? How does it work? Core DBA skill → A way of searching for & extracting data from tables table에서 data를 검색하거나 추출하는 방법 What does it do? Find target information → Retrieve, Filter, Sort, Aggregate/Summarize Manipulate data → Add, Change, Delete, Combine (& calculate) data in tables Assemble/Supply data → for Forms and Reports How does it work? Query object  SQL & a dynaset (“live” view of table) Data changes made in query is reflected in underlying tables Database Design

Access Queries: Views Datasheet view Design View For displaying the result of the query → Useful for reviewing/validating the query Design View For creating/modifying a query via drag & drop GUI Object Relationship Pane Add tables/queries Add fields to the Design Grid creation: CUSTOMER table multi-table query: PRODUCT+SUPPLIER qrySensless, qrySensible Design Grid Sort row → ascending/descending sort Show row → show/hide fields Criteria row → apply data filter Totals row → compute aggregate stats Database Design

Access Queries: Basic Types Simple Query Uses a single table/query To generate a subset (row/column) of a table Multi-table Query Joins multiple tables/queries Joining tables in Query Design does not permanently link tables Select Query Selects records that meet given criteria Criteria row ← Selection Criteria Parameter Query Prompts for query criteria values (parameters) to run a dynamic query Criteria row ← [Query Prompt] (or Search Form control name) update: publisher + publication set Available=No for publisher JimBob Publishing append crosstab how many works each producers produce in each category? Database Design

Access Queries: Sort & Filter Design View Sort using the Sort Row Sort priority is from left to right for multiple sort Filter using the Criteria Row AND query ← criteria in a single row OR query ← criteria in multiple rows Criteria in a single cell → AND/OR Query Criteria Determines which record to include “expressions” that consist of Constants (e.g., 2000, “Adams”) Operators (e.g., >, +, *, AND) Functions (e.g., DateDiff) Field references (e.g., [Lastname]) - Gcflearnfree.org - CUSTOMER wildcard: tblVoters Database Design

Access Queries: Query Criteria Date/Time fields Number fields Expression Returns Between #1/1/15# and #12/31/15# Dates from 1/1/2015 to 12/31/2015 > #1/1/15# After 1/1/2015 < Date() Before today DateDiff(“yyyy”,Date(),[Birthdate]) > 60 Over 60 years old DatePart(“m”, [Birthdate]) = 12 Born in December Expression Returns Between 10 and 20 Number from 10 to 20 >= 10 Greater than or equal to 10 10 Equal to 10 Not 10 Not equal to 10 Is Null No value is entered In (5,10,15) Number equal to 5, 10, or 15 Database Design

Access Queries: Query Criteria Text fields Expression Returns In (“John”, “Mary”, “Jane”) Equal to John, Mary, or Jane Like “J*” Starts with “j” Like “*s” Ends with “s” Like “*oh*” Contains “oh” Like “[A-C]??” Starts with A through C and has two more characters ???? Any 4 characters Len([LastName]) = Val(4) Any LastName of 4 characters Right([LastName],2) = “es” Any LastName ending in “es” (same as Like “*es”) Left([LastName],2)= “Ja” Any LastName starting with “Ja” (same as Like “Ja*”) Is Null No value is entered Is Not Null Value is not missing Not “James” Not equal to “James” Database Design

Access Queries: Expressions Using expressions to create a Calculated Field Enter expressions in blank column of query design view NAME: [Field1] operator [Field2] Examples Simple math DiscountPrice: [Discount] * [StandardPrice] String Concatenation Author: [FirstName] & “ ” & [Lastname] Date & Time math HireAge: DateDiff(“yyyy”,[BirthDate],[HireDate]) DateDiff(Interval, BeginDate, EndDate) RetireDate: DateAdd(“yyyy”,25,[HireDate]) DateAdd(Interval, Number, Date) Customized Sorting/Format Branch: Switch([City]=“Seattle”, 1, [City]=“Redmond”, 2, [City]=“New York”, 3) Switch(expr1, value1, expr2, value2, etc.) tbleCustomerDiscounts + tblPrices add Cname, discount, Stdprice Zoom Window (Shift+F2) Dolla Discount: [Discount]*[StandardPrice] Net Price: [Standardprice]-[dolla discount] new Q: add EMPLOYEE create name field Hireage: DateDiff(“yyyy”,[BirthDate],[HireDate]) Database Design

Access Queries: Sort & Filter Datasheet View Common Filters → Filter for specific values Click the icon on the right side of the field label Check the values for the filter OR Click the Range Filter (e.g. Date Filter) & specify the filter value Filter by Selection → Filter by selected value Select a specific value in the datasheet Right-click & select a filtering option CUSTOMER wildcard: tblVoters Database Design

Access Queries: Sort & Filter Datasheet View Filter by Form → Filter on several fields on a form Click Advanced in Sort & Filter group of Home tab Select Filter by Form Select multiple filter values as needed Advanced Filter → Define custom filters → Learn how to write query criteria Create a filter by Common Filter, Selection, or Form Select Advanced Filter/Sort CUSTOMER wildcard: tblVoters Database Design

Access Queries: Dynamic Criteria Parameter Queries Dynamic query based on varying criteria value Enter the parameter name in square brackets in criteria Do not use existing field names Can use expressions → e.g. Like "*" & [Last Name] & "*“ Database Design

Access Queries: Dynamic Criteria Query Criteria from Form Entries Use a form to enter query parameter values → good for multiple parameter entries Create a parameter query Create a search form with unbound input control for each of query parameters Add a command button that will run the parameter query Run Query Action of Miscellaneous Category Change the query criteria to search form control names Database Design

Access Queries: Joins Inner Join Outer join Default join in Access (i.e. Natural Join) Returns only the records where joined fields are equal in both tables Outer join Returns all records from one of the tables Theta Join: CHARTER & MODEL Database Design