Organizational Decision-Making and Process Management (BPM)
description
Transcript of Organizational Decision-Making and Process Management (BPM)
![Page 1: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/1.jpg)
More on MS Access queries
BSAD 141Dave Novak
![Page 2: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/2.jpg)
Topics Covered MS Access query capabilities
Aggregate queries Different joinsReview: AND and ORParameter queryExact match criteria versus rangeFormatting calculated fieldsReportsImporting and exporting data to/from AccessPivot tables
![Page 3: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/3.jpg)
Aggregate Queries
Use Northwind DB you downloaded last class Aggregate Query: For each of your customers,
what is the total Quantity of Sasquatch Ale ordered from you?Need Customer.CompanyName and
Products.Category infoNote that the Customer table is not linked to the
Products tableNeed to add all intersection tables to associate
customers to products
![Page 4: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/4.jpg)
Aggregate Queries
Find this by looking at the relationships Show tableAdd Orders and Order DetailsName query “Customer Orders”
![Page 5: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/5.jpg)
Aggregate Queries
In your newly created “Customer Orders” query select:Customers.CompanyNameProducts.CategoryIDProducts.ProductNameOrder Details.Quantity
What is the query returning exactly?Sort ascending order by CompanyName
![Page 6: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/6.jpg)
Aggregate Queries
What is the query returning exactly?Sort ascending order by CompanyName
Return all Customers who have ordered Sasquatch ale from youProduce a summary count of the orders by
customerProduce a summary count of the total quantity
ordered from you, regardless of how many orders the customer has placed
![Page 7: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/7.jpg)
Aggregate QueriesIn Query Design View, on the ‘Design’ Ribbon,
click on the Totals button
This will show the ‘Totals’ row in the Criteria area
Toggle to SQL view Notice the Inner Joins
![Page 8: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/8.jpg)
Aggregate Queries
How many orders did each customer have? Which customers have ordered the most? The
least?
![Page 9: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/9.jpg)
Join Types – Inner and Outer
INNER JOINS (default) only return results where there is a match between the Foreign key and the primary key Null Foreign Key values will be ignored Primary Key values that do not have an instance in
the foreign key set will be ignored
OUTER JOINS when you want ‘all’ from one table or the other’ or both
![Page 10: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/10.jpg)
Left & Right Outer Joins In Query Design, you can change the ‘behavior’ of the
join relationship between the tables depending on desired results. Double click the relationship to open the Join options
Read the Options…
![Page 11: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/11.jpg)
SQL Join Types
INNER JOIN: Return rows when there is at least one match in both tables (default join)
LEFT OUTER JOIN: Return all rows from the left table, even if there are no matches in the right table
RIGHT OUTER JOIN: Return all rows from the right table, even if there are no matches in the left table
FULL OUTER JOIN: Return rows when there is a match in one of the tables
![Page 12: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/12.jpg)
A B C
OrdersCustomers
INNER JOIN (Default) of Customers and Orders: JUST B (where FK value isn’t NULL)
RIGHT OUTER JOIN of Customers and Orders: B and C (all Orders even if NOT assigned to a Customer
LEFT OUTER JOIN of Customers and Orders: A and B (All Customers even if NO order associated to them)
FULL OUTER JOIN of Customers and Orders: A and B and C (Customers who have ordered, customers who haven’t ordered and orders not associated to customers)
![Page 13: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/13.jpg)
Types of Queries Continued Query Criteria Or vs. And in QBE.
List all companies who ordered a total Quantity of any product greater than 50 (regardless of product)
Sort by Company Name then quantity
What if we just want to return the absolute total quantity of products ordered by each customer where the TOTAL is greater than 50?
![Page 14: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/14.jpg)
Types of Queries Continued Remove CategoryID and ProductName from
the query Rename query “Customer Order Summary”
by selecting File Save as Save Object As Run the new “Customer Order Summary”
querySort by Quantity in descending order
![Page 15: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/15.jpg)
Types of Queries Continued Query Criteria Or vs. And in QBE
Go back to the Customer Orders queryReturn a list all companies who ordered a
total Quantity of any product greater than 50 AND had a Total Price greater than $5000 by product
Need to create the calculated field Total Price
Which company has the highest order total in terms of dollars spent on a particular product?
![Page 16: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/16.jpg)
Types of Queries Continued Query Criteria Or vs. And in QBE.
List all Companies who made orders for products with Quantity (Order Details) greater than 50 OR had a Total Price greater than $5000
Return companies have ordered at least 500 units of some type of product from you by the total amount of money they spend• Top 5 by quantity bought from you• Top 5 by total dollars spent
![Page 17: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/17.jpg)
Parameter Queries Parameter Query. Prompts Users for a value at the time the
query is run. Quite Common in home grown DBs Place what you want the User to see when prompted in Brackets
in the Criteria Field:• [What year would you like results for?]
Be sure your prompt text is NOT an available field name When query is executed, the user entered value is passed
through to the criteria of the query
![Page 18: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/18.jpg)
18
Defining Record Selection Criteria for Queries Just as you can display selected fields from a
database in a query datasheet, you can display selected records
To tell Access which records you want to select, you must specify a condition as part of the query
A comparison operator asks Access to compare the value in a database field to the condition value and to select all the records for which the relationship is true
![Page 19: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/19.jpg)
Specifying an Exact Match With an exact match, the value in the
specified field must match the condition exactly in order for the record to be included in the query results
![Page 20: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/20.jpg)
20
Defining Record Selection Criteria for Queries Text versus some type of numeric field
![Page 21: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/21.jpg)
Using a Comparison Operator
to Match a Range of Values
![Page 22: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/22.jpg)
New Perspectives on Microsoft Office 2007: Windows XP Edition
22
Defining Multiple Selection Criteria for Queries
![Page 23: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/23.jpg)
23
Defining Record Selection Criteria for Queries Between operator
Between 5 and 10
![Page 24: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/24.jpg)
24
Formatting Calculated Results Click in calculated field Right click and choose properties The “Property Sheet” menu will appear on the
right side of the screen Use pulldown menu
![Page 25: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/25.jpg)
25
Formatting Calculated Results Change the column heading for the Total
Price field to “Dollars Spent”
![Page 26: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/26.jpg)
26
Creating Reports Using the automatic report generator
![Page 27: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/27.jpg)
27
Importing and Exporting Export the Products table to Excel
Open Products.xlsxInsert Recommended Pivot Tables
• Some will be useful, some notCan explore options using drag and drop GUI
Importing data into Access
![Page 28: Organizational Decision-Making and Process Management (BPM)](https://reader035.fdocuments.in/reader035/viewer/2022081507/568168af550346895ddf6cdd/html5/thumbnails/28.jpg)
Summary Using queries in MS Access
Aggregate queries Different joinsReview: AND and ORParameter queryExact match criteria versus rangeFormatting calculated fieldsReportsImporting and exporting data to/from AccessPivot tables