1 Chapter 4: Creating Simple Queries 4.1 Introduction to the Query Task 4.2 Selecting Columns and Filtering Rows 4.3 Creating New Columns with an Expression.

Slides:



Advertisements
Similar presentations
Decision Analysis Tools in Excel
Advertisements

Concepts of Database Management Seventh Edition
Concepts of Database Management Sixth Edition
Concepts of Database Management Seventh Edition
Chapter 6: Pivot Tables Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2: Relational Databases.
Access Tutorial 3 Maintaining and Querying a Database
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 3 1 Microsoft Office Access 2003 Tutorial 3 – 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.
1 Committed to Shaping the Next Generation of IT Experts. Chapter 3 – Graphs and Charts: Delivering a Message Robert Grauer and Maryann Barber Exploring.
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.
Access Tutorial 3 Maintaining and Querying a Database
Quick Start Guide: Filters Advanced Learn about: 1.What filters are and their functionality 2.How to create a filter using Samples, Equipment & Labels.
Maintaining and Querying a Database Microsoft Access 2010.
Developing Effective Reports
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.
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 Chapter 5: Creating Summarized Output 5.1 Generating Summary Statistics 5.2 Creating a Summary Report with the Summary Tables Task 5.3 Creating and Applying.
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.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall1 Exploring Microsoft Office Access Committed to Shaping the Next Generation.
1 Chapter 4: Creating Simple Queries 4.1 Introduction to Querying Data 4.2 Filtering and Sorting Data 4.3 Creating New Columns with an Expression 4.4 Grouping.
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.
XP New Perspectives on Integrating Microsoft Office XP Tutorial 2 1 Integrating Microsoft Office XP Tutorial 2 – Integrating Word, Excel, and Access.
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.
Management Information Systems MS Access MS Access is an application software that facilitates us to create Database Management Systems (DBMS)
® Microsoft Office 2010 Access Tutorial 3 Maintaining and Querying a Database.
Concepts of Database Management Seventh Edition
® Microsoft Office 2010 Access Tutorial 3 Maintaining and Querying a 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.
XP Chapter 3 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Analyzing Data For Effective Decision Making Chapter.
1 Chapter 2: Working with Data in a Project 2.1 Introduction to Tabular Data 2.2 Accessing Local Data 2.3 Accessing Remote Data 2.4 Importing Text Files.
Introduction to Enterprise Guide Jennifer Schmidt Rhonda Ellis Cassandra Hall.
® Microsoft Access 2010 Tutorial 3 Maintaining and Querying a Database.
COMPREHENSIVE Access Tutorial 3 Maintaining and Querying a Database.
1 Chapter 6: Using Prompts in Tasks and Queries 6.1 Prompting in Projects 6.2 Creating and Using Prompts in Tasks 6.3 Creating and Using Prompts in Queries.
1 Lesson 18 Managing and Reporting Database Information Computer Literacy BASICS: A Comprehensive Guide to IC 3, 3 rd Edition Morrison / Wells.
The Advantage Series © 2004 The McGraw-Hill Companies, Inc. All rights reserved Creating Select Queries Chapter 6 Microsoft Office Access 2003.
LANDESK SOFTWARE CONFIDENTIAL Tips and Tricks with Filters Jenny Lardh.
1 Chapter 7: Customizing and Organizing Project Results 7.1 Combining Results 7.2 Updating Results 7.3 Customizing the Output Style (Self-Study)
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.
Online Catalog Tutorial. Introduction Welcome to the Online Catalog Tutorial. This is the place to find answers to all of your online shopping questions.
XP New Perspectives on Microsoft Access 2002 Tutorial 31 Microsoft Access 2002 Tutorial 3 – Querying a Database.
® Microsoft Access 2010 Tutorial 5 Creating Advanced Queries and Enhancing Table Design.
1 Chapter 3: Getting Started with Tasks 3.1 Introduction to Task Dialogs 3.2 Creating a Listing Report 3.3 Creating a Frequency Report 3.4 Creating a Two-Way.
Excel part 5 Working with Excel Tables, PivotTables, and PivotCharts.
1 Chapter 1: Getting Started 1.1 Introducing SAS Enterprise Guide 1.2 Course Scenarios.
21 Copyright © 2009, Oracle. All rights reserved. Working with Oracle Business Intelligence Answers.
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.
22 Copyright © 2009, Oracle. All rights reserved. Filtering Requests in Oracle Business Intelligence Answers.
Chapter 3: Getting Started with Tasks
Creating Oracle Business Intelligence Interactive Dashboards
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
Microsoft Office Illustrated Fundamentals
Access Maintaining and Querying a Database
Microsoft Office Access 2003
Tutorial 3 – Querying a Database
CIS16 Application Programming with Visual Basic
Microsoft Office Access 2003
Introduction to Database Programs
Introduction to Database Programs
Assignment 3 Querying and Maintaining a Database
Tutorial 5 Advanced Queries and Enhanced Table Design
Presentation transcript:

1 Chapter 4: Creating Simple Queries 4.1 Introduction to the Query Task 4.2 Selecting Columns and Filtering Rows 4.3 Creating New Columns with an Expression 4.4 Creating New Columns by Recoding Values 4.5 Joining Tables 4.6 Joining Tables Including Non-Matching Rows (Self-Study)

2 Chapter 4: Creating Simple Queries 4.1 Introduction to the Query Task 4.2 Selecting Columns and Filtering Rows 4.3 Creating New Columns with an Expression 4.4 Creating New Columns by Recoding Values 4.5 Joining Tables 4.6 Joining Tables Including Non-Matching Rows (Self-Study)

3 Objectives State the function of the query task. Name the areas within the Query Builder dialog. State the function of the areas within the Query Builder dialog.

4 Query Builder The Query Builder is used to extract data from one or more tables according to the criteria specified by the user.

5 Query Builder: Select Data The Select Data tab is used to select which columns are included and what their roles are in the query.

6 Query Builder: Filter Data The Filter Data tab is used to retrieve rows that meet certain criteria, based on existing or calculated columns.

7 Query Builder: Computed Columns The Computed Columns button is used to add new columns, either by building an expression or recoding an existing column.

8 Query Builder: Tables and Joins The Tables and Joins window is used to join multiple tables based on a relationship between columns.

9 Query Builder: Parameters The Parameters button enables you to define a query that returns different results based on values you provide at runtime.

10 Chapter 4: Creating Simple Queries 4.1 Introduction to the Query Task 4.2 Selecting Columns and Filtering Rows 4.3 Creating New Columns with an Expression 4.4 Creating New Columns by Recoding Values 4.5 Joining Tables 4.6 Joining Tables Including Non-Matching Rows (Self-Study)

11 Objectives Apply a filter in a query. Exclude columns in a query. Reorder columns in a query. Modify a column’s properties.

12 Selecting Both Rows and Columns

13 Selecting Columns By default, a query starts out empty. You must add any columns to be included in the query to the Select Data tab. Drag and drop or right- click to add columns to the Select Data tab. Modify a column’s properties.

14 Filtering Rows The process of specifying which rows to retrieve in a query is called setting a filter and is done in the Filter Data tab. 2) Drop the column in here. 1) Drag a column from here.

15 Setting a Filter When a column is dropped on the Filter Data tab, the Edit Filter dialog opens. Type the value(s) or expression. Choose the type of comparison.

16 Setting an Advanced Filter Select New Advanced Filter... to open the Advanced Expression Editor and create a new filter. Create an advanced filter to build your own condition.

17 Advanced Expression Editor: Functions 1) Select the type of function. 2) Select a specific function.

18 Advanced Expression Editor: Data 1) Select a column to view distinct values. 2) Select values to include in the expression.

19 Combining Filters By default, multiple filters are combined with AND. The Filter Combination window can be used to further customize the way multiple filters are evaluated.

20 Final Results: Selecting Rows and Columns

21 Using Query Results in Tasks Tables generated from queries can serve as the active data source for follow-up tasks.

22 Scenario LLB wants to determine how many non-U.S. companies supply products to LLB. The report should reflect the following: the total number of suppliers in each country, excluding the United States countries with the most suppliers listed first

23 Scenario Partial Output

24 This demonstration illustrates how to set a filter and exclude columns in the Query Builder task. Selecting Columns and Filtering Rows

25 Chapter 4: Creating Simple Queries 4.1 Introduction to the Query Task 4.2 Selecting Columns and Filtering Rows 4.3 Creating New Columns with an Expression 4.4 Creating New Columns by Recoding Values 4.5 Joining Tables 4.6 Joining Tables Including Non-Matching Rows (Self-Study)

26 Objectives Define a new column of data in a query by building an expression.

27 Computing a New Column Revenue = Quantity * SellPrice

28 Computed Columns Create new columns.

29 Advanced Expression Editor 1) Choose a method for computing the new column. 2) Use the Advanced Expression Editor to build the expression.

30 Computed columns appear in the left pane and can be used in a filter on the Filter Data tab or as an input to another computed column. New Computed Columns

31 Scenario LLB wants to know the projected inventory of each product at any given moment. The products table is constantly changing with daily updates for the number of units in stock and the number of units on order. ProjectedInventory = UnitsInStock + UnitsOnOrder

32 This demonstration illustrates how to use the Advanced Expression Editor to define a column of data in the Query Builder task. Creating a Column with an Expression

33 Chapter 4: Creating Simple Queries 4.1 Introduction to the Query Task 4.2 Selecting Columns and Filtering Rows 4.3 Creating New Columns with an Expression 4.4 Creating New Columns by Recoding Values 4.5 Joining Tables 4.6 Joining Tables Including Non-Matching Rows (Self-Study)

34 Objectives Recode individual values or a range of values in a column.

35 Recoded Columns New columns can also be calculated by recoding values from an existing column.

36 Recoded Values Recoding a column enables you to assign a value to a new column based on the value of an existing column. When State='CA' Then Region = 'West' TRUE Then Region = 'Central' TRUE Then Region = 'East' TRUE When State='NY' FALSE When State='MI' FALSE

37 Recode a Column When you recode a column, a prompt will appear to select the existing column to be used to generate the new column.

38 Specify a Replacement 2) Use Replace Values or Replace a Range to map the recoded values to the original data. 1) Select Add… to assign the new recoded values.

39 Recoding a Column Assign values for all other cases. Select the appropriate type for the new column.

40 Using the New Recoded Column The new recoded column is automatically included in the Select Data tab. The new column can also be used in the Filter Data or Sort Data tabs as well. To sort by a column, drag the column into the Sort Data tab and select the Sort Direction.

41 Scenario LLB wants to know how the unit costs for the products are distributed within each food category. Rank each product into three unique groups based on the unit cost: $0 to $14.99, $15 to $29.99, and $30 and Above.

42 Partial Table Analysis Results

43 This demonstration illustrates the use of the Replace Values tab in a query to create a new column based conditionally upon an existing column. Creating a New Column by Recoding Values

44 Chapter 4: Creating Simple Queries 4.1 Introduction to the Query Task 4.2 Selecting Columns and Filtering Rows 4.3 Creating New Columns with an Expression 4.4 Creating New Columns by Recoding Values 4.5 Joining Tables 4.6 Joining Tables Including Non-Matching Rows (Self-Study)

45 Objectives Join multiple tables by common columns. Include only matching rows.

46 Joining Tables Joining tables enables you to extract and process data from more than one table at a time.

47 Joining Tables Matching rows only

48 Joining Tables Matching rows only

49 Adding Tables Select Add Tables… to include additional data sources in the query.

50 Tables and Joins Window 1) Select Join… to access the Tables and Joins window. 2) Use the Tables and Joins window to specify how multiple tables relate.

51 Modify Join Window The join criteria can be modified to include non-matching rows from either or both tables.

52 Query Builder: Selecting a Server Use the Result Options window to specify the SAS server that should be used to execute the query.

53 Join Results From USCustomerDatabaseLong From ItemsOrdered

54 Scenario LLB wants to compute the total profits generated from each order. The profit that LLB earns from each order can be calculated as the difference between the selling price and the unit cost multiplied by the quantity of items ordered. LLB stores this quarter's information about its suppliers, products, and orders in three separate tables.

55 Scenario: Separate Tables

56 Scenario: Joined Table with New Column Profit = (SellPrice – UnitCost) * Quantity

57 This demonstration illustrates how to join multiple tables and store the result in a data table. Joining Tables

58 Complete the Chapter 4 exercises starting on page Detailed solutions are provided starting on page Exercises

59 Chapter 4: Creating Simple Queries 4.1 Introduction to the Query Task 4.2 Selecting Columns and Filtering Rows 4.3 Creating New Columns with an Expression 4.4 Creating New Columns by Recoding Values 4.5 Joining Tables 4.6 Joining Tables Including Non-Matching Rows (Self-Study)

60 Objectives Perform different join types.

61 Joining Tables Types of Joins: Matching Rows Only (SAS Enterprise Guide default) –produces results where only the rows from one table that have a corresponding match in every other table are returned. All Rows from one or both tables –produces results where all of the matched rows from both tables and the unmatched rows from at least one table are returned. All Rows from AAll Rows from A and BAll Rows from B A B

62 Review: Matching Rows Only

63 Including Non-Matching Rows All rows from CustomerDatabase and ItemsOrdered

64 Including Non-Matching Rows All rows from CustomerDatabase

65 Including Non-Matching Rows All rows from ItemsOrdered

66 Review: Modify Join Window The join criteria can be modified to include non-matching rows from either or both tables.

67 Modifying a Join: Results Results include all orders that are in the ItemsOrdered table, whether customer information in the CustomerDatabase table exists or not.

68 Isolating Non-Matching Rows The query can also include a filter to isolate the non-matching rows from one or both tables. Orders placed by customers who do not exist in the CustomerDatabase table

69 Scenario When products are discontinued, they are removed from the products table. LLB wants to generate a query on a regular basis to identify orders placed on discontinued products.

70 This demonstration illustrates how to change the join type to include non-matching rows in a query. Joining Tables Including Non-Matching Rows

71 Complete Exercise 6 starting on page Detailed solutions are provided starting on page Exercises