Queries with Multiple Criteria (OR)

Similar documents
Access Objects. Tables Queries Forms Reports Relationships

Creating a Crosstab Query in Design View

Access Review. 4. Save the table by clicking the Save icon in the Quick Access Toolbar or by pulling

Microsoft Access 2010

Exchange Address Book Order

Microsoft Access 2013

Microsoft Access 2013

Microsoft Access 2013

Tutorial 1. Creating a Database

INSERT SUBTOTALS Database Exercise Sort the Data Department Department Data Tab Sort and Filter Group

Module 5. Databases. Astro Computer Training. Page 1

SECTION 4 USING QUERIES. What will I learn in this section?

Database Design Lab: MS Access Queries

M i c r o s o f t. Office Introductory Concepts and Techniques. Access Project 1. Creating and Using a Database

Switchboard. Creating and Running a Navigation Form

Chapter 5: Hierarchical Form Lab

Microsoft Office Outlook 2007: Intermediate Course 01 Customizing Outlook

Working with Macros. Creating a Macro

Microsoft Access 2010

AUSTIN COMMUNITY COLLEGE CONTINUING EDUCATION. INTRODUCTION TO DATABASE/FILE MANAGEMENT (Access Introduction) (12 hours) ITSW 1053 COURSE SYLLABUS

Step 1: Create a totals query to show the total cost price and total sale price of the wine for each supplier.

Introduction to Microsoft PowerPoint 2016

Chapter 3. Introduction to relational databases and MySQL. 2010, Mike Murach & Associates, Inc. Murach's PHP and MySQL, C3

Introduction. Opening and Closing Databases. Access 2010 Managing Databases and Objects. Video: Working with Databases in Access 2010

Copyright 2012 Pulse Systems, Inc. Page 1 of 29

1. AUTO CORRECT. To auto correct a text in MS Word the text manipulation includes following step.

Module 4 : Spreadsheets

Introduction to Microsoft Access

Microsoft Excel & The Internet. J. Carlton Collins ASA Research

PRODUCTIVITY TIPS USING OUTLOOK Washtenaw Community College

Sent Items Organizer User s Manual

Access. Basics PRESENTED BY THE TECHNOLOGY TRAINERS OF THE MONROE COUNTY LIBRARY SYSTEM

To complete this database, you will need the following file:

Exercise 1: Assigning Responsibilities to Delegates (This was called Proxy in GroupWise)

Enforce Referential. dialog box, click to mark the. Enforce Referential. Integrity, Cascade Update Related Fields, and. Cascade Delete Related

Using Standard Generation Rules to Generate Test Data

Creating More Detailed Forms

Introduction. Inserting and Modifying Tables. Word 2010 Working with Tables. To Insert a Blank Table: Page 1

Microsoft Office Excel 2007: Basic Course 01 - Getting Started

Office 2010: New Features Course 01 - The Office 2010 Interface

To complete this database, you will need the following file:

WEEK NO. 12 MICROSOFT EXCEL 2007

COMM 391 Winter 2014 Term 1. Tutorial 1: Microsoft Excel - Creating Pivot Table

Microsoft Access 2003 Edition for ECDL Syllabus 4.5 (UK only)

Microsoft Access XP Edition for ECDL Syllabus 4.5 (UK only)

Grapher 10 Ribbon Bar

Adding Parts to the PriceBook by Import and Associating Vendor Part Information

Reference Services Division Presents. Excel Introductory Course

Trident Trust PowerPoint User Guide

Name: Class: Date: Access Module 2

SPREADSHEET (Excel 2007)

Tutorial 2: Queries and Reports

More Skills 12 Create Web Queries and Clear Hyperlinks

training handout EMIS Web: Batch Data Manager Access Batch Data Manager Batch add a clinical code

Formatting Values. 1. Click the cell(s) with the value(s) to format.

Access: Printing Data with Reports

Introduction to Queries

Animation: Enter Vouchers by Item or Amount?

Microsoft Office Access Learn how to use the Query window in Design view. Tutorial 3b Querying a Database

In this tutorial we will discuss different options available in the Options tab in EMCO Network Inventory 4.x.

Advisor Workstation Quick Start Guide

Introduction to Application Software for Office Use, Microsoft Office 2010 and Windows Environment

Use Active Directory To Simulate InfoPath User Roles

Topics Covered in Video:

UMHS Financial Systems Workspace & Smart View Templates

Navigation Bar Icons

Introduction to Microsoft Excel 2010

Working with Database & Objects

Quick Tips & Tricks. Important You must use SEMICOLONS ( ie; ) to separate address when sending mail to multiple users

Incoming Mail Organizer User s Manual

Getting Started The Application Window Office Office 2003 Application Window cont d

Word 3 Microsoft Word 2013

Activant Prophet 21. Using Fast Edits on Your Database

2. create the workbook file

Objective 1: Familiarize yourself with basic database terms and definitions. Objective 2: Familiarize yourself with the Access environment.

Shopping Cart: Queries, Personalizations, Filters, and Settings

Lab Manual Access Module

BDM Hyperion Workspace Basics

New Perspectives on PowerPoint Module 2: Adding Media and Special Effects

An Introduction to Basic ClassPad Manipulations and eactivity

Microsoft Office 2010: Introductory Q&As Access Chapter 2

JUNE 2016 PRIMAVERA P6 8x, CONTRACT MANAGEMENT 14x AND UNIFIER 16x CREATING DASHBOARD REPORTS IN ORACLE BI PUBLISHER

ESRI stylesheet selects a subset of the entire body of the metadata and presents it as if it was in a tabbed dialog.

Instructions for creating and modifying queries will be available in the future.

If this is the first time you have run SSMS, I recommend setting up the startup options so that the environment is set up the way you want it.

The University of New Orleans PeopleSoft 9.0: Working with the List Page for Reports

Introduction. Saving Workbooks. Excel 2010 Saving. To Use the Save As Command: Page 1

FCMT Advanced Find User Guide

Introduction to relational databases and MySQL

Budget Exercise for Intermediate Excel

Microsoft Access 2003 Quick Tutorial

4. In the Address Book drop-down list, click the address book that contains the addresses you want in your distribution list.

Tutorial 2. Building a Database and Defining Table Relationships

Office 365 Employee San Jac Outlook 2010

Excel 2010 Charts - Intermediate Excel 2010 Series The University of Akron. Table of Contents COURSE OVERVIEW... 2

Create Forms 5. KEY TERMS Blank Form tool common filters filter filter by form Form Design button Form tool Form Wizard Themes LESSON SKILL MATRIX

Morningstar Advisor Workstation SM Quick Start Guide

Shelly Cashman Series Microsoft Office 365 and Access 2016 Introductory 1st Edition Pratt TEST BANK

Skills Exam Objective Objective Number. Creating crosstab queries Create a crosstab query

Introduction to Microsoft Excel

Transcription:

Queries with Multiple Criteria (OR) When a query has multiple criteria, logical operators such as AND or OR combine the criteria together. This exercise has two example questions to illustrate, in two different cases, the use of the OR operator to combine criteria. The OR logical operator specifies that just one criteria is true or both criteria are true for a record to display when you run the query.

Queries with Multiple Criteria (OR) If necessary: Start Microsoft Access. Open the database file Queries from your Exploring Access folder.

Question 1 Multiple Criteria, Same Field, Logical OR Operator Just read this slide! Question 1 illustrates: A multiple criteria query. The criteria are for the same field. The criteria are combined with the OR operator. Question 1: List all of the products whose units in stock is less than 20 or greater than 100 using the ProductName, UnitsInStock, and UnitPrice fields of the Products table. Save this query as Products with Few or Many in Stock.

Question 1 Multiple Criteria, Same Field, Logical OR Operator Click the Query Design button in the Queries group on the CREATE tab of the ribbon bar.

Question 1 Multiple Criteria, Same Field, Logical OR Operator To add the Products table to the query window. Double-click the Products table.

Question 1 Multiple Criteria, Same Field, Logical OR Operator Click the Close button to close the Show Table dialog box.

Question 1 Multiple Criteria, Same Field, Logical OR Operator Double-click the ProductName, UnitsInStock and UnitPrice fields in the Products table window. To add these fields to the query s design grid.

Question 1 Multiple Criteria, Same Field, Logical OR Operator Both criteria are written for the UnitsInStock field. The 1 st criteria for Question 1 is: <20 The 2 nd criteria for Question 1 is: >100 Because both criteria are written for the same field, the two criteria are combined using the OR operator as such: <20 Or >100

Question 1 Multiple Criteria, Same Field, Logical OR Operator Type <20 Or >100 in the first Criteria row of the UnitsInStock column.

Question 1 Multiple Criteria, Same Field, Logical OR Operator The criteria for Question 1 reads as: UnitsInStock < 20 or UnitsInStock > 100

Question 1 Multiple Criteria, Same Field, Logical OR Operator Click the Save button on the Quick Access Toolbar.

Question 1 Multiple Criteria, Same Field, Logical OR Operator Type Products with Few or Many in Stock in the Query Name textbox. Click the OK button to save the query.

Question 1 Multiple Criteria, Same Field, Logical OR Operator The completed query.

Question 1 Multiple Criteria, Same Field, Logical OR Operator Click the Run button in the Results group of the DESIGN tab in the QUERY TOOLS section of the ribbon bar.

Question 1 Multiple Criteria, Same Field, Logical OR Operator When you run this query, it displays all the products (Product records) 1. whose units in stock is less than 20, OR 2. whose units in stock is greater than 100. According to logic, if both operands of the OR operator are true, then the result of the OR is true. But, for the use of OR in this query, it is impossible for both criteria to be true for a record to display in the query. Go to the next slide to see the records displayed for this query.

Question 1 Multiple Criteria, Same Field, Logical AND Operator Close the query.

Question 2 Multiple Criteria, Different Fields, Logical OR Operator Just read this slide! Question 2 illustrates: A multiple criteria query. The criteria are for different fields. The criteria are combined with the OR operator. Question 2: List all of the books that are published after 1996 or whose list price is greater than or equal to 40 dollars using the Title, Year, ListPrice and Publisher fields of the Books table. Save this query as New or Expensive Books.

Question 2 Multiple Criteria, Different Fields, Logical OR Operator Click the Query Design button in the Queries group on the CREATE tab of the ribbon bar.

Question 2 Multiple Criteria, Different Fields, Logical OR Operator To add the Books table to the query window. Double-click the Books table.

Question 2 Multiple Criteria, Different Fields, Logical OR Operator Click the Close button to close the Show Table dialog box.

Question 2 Multiple Criteria, Different Fields, Logical OR Operator If necessary, increase the height of the Books table window to view all the fields. Double-click the Title, Year, ListPrice and Publisher fields in the Books table window. To add these fields to the query s design grid.

Question 2 Multiple Criteria, Different Fields, Logical OR Operator The Year criteria for Question 2 is: >1996 The ListPrice criteria for Question 2 is: >=40 Because each criteria is written for a different field, the two criteria can not be combined using the word OR. To combine both criteria with the OR operator: Each criteria is written in a criteria row for its field. Each criteria must be written on a different row.

Question 2 Multiple Criteria, Different Fields, Logical OR Operator Type >1996 in the first Criteria row of the Year column.

Question 2 Multiple Criteria, Different Fields, Logical OR Operator Type >=40 in the second Criteria row of the ListPrice column.

Question 2 Multiple Criteria, Different Fields, Logical OR Operator The criteria for Question 2 reads as: Year > 1996 or ListPrice >= 40

Question 2 Multiple Criteria, Different Fields, Logical OR Operator Click the Save button on the Quick Access Toolbar.

Question 2 Multiple Criteria, Different Fields, Logical OR Operator Type New or Expensive Books in the Query Name textbox. Click the OK button to save the query.

Question 2 Multiple Criteria, Different Fields, Logical OR Operator The completed query.

Question 2 Multiple Criteria, Different Fields, Logical OR Operator Click the Run button in the Results group of the DESIGN tab in the QUERY TOOLS section of the ribbon bar.

Question 2 Multiple Criteria, Different Fields, Logical OR Operator When you run this query, it displays all the books (Book records) 1. whose year is greater than 1996, OR 2. whose list price is greater than or equal to 40 dollars, OR 3. whose year is greater than 1996 and list price is greater than or equal to 40 dollars. According to logic, if both operands of the OR operator are true, then the result of the OR is true. Number 3 above is this case and for the use of OR in this query, it is possible for both criteria to be true for a record to display in the query. Go to the next slide to see the records displayed for this query.

Question 2 Multiple Criteria, Different Fields, Logical OR Operator

Question 2 Multiple Criteria, Different Fields, Logical OR Operator Close the query. Close the database file and Microsoft Access.