Queries.

Slides:



Advertisements
Similar presentations
Jeopardy Objects Navigation Buttons True/False Parts of a Report Vocabulary Q $100 Q $200 Q $300 Q $400 Q $500 Q $100 Q $200 Q $300 Q $400 Q $500 Final.
Advertisements

Chapter 5 Creating, Sorting, and Querying a Table
Microsoft Office 2007 Access Chapter 2 Querying a Database.
Querying a Database Using the Select Query Window
Mary K. Olson PS Reporting Instance – Query Tool 101.
Microsoft Access 2010 Chapter 7 Using SQL.
1 Access Lesson 3 Creating Queries Microsoft Office 2010 Introductory Pasewark & Pasewark.
1 Access Lesson 3 Creating Queries Microsoft Office 2010 Introductory.
Microsoft Access Intro Class 5 Working with Queries.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 4 BACKNEXTEND 4-1 LINKS TO OBJECTIVES Query Design Query Criteria Modify a Query Using OR.
Microsoft Access 2010 Building and Using Queries.
Analyzing Data For Effective Decision Making Chapter 3.
® Microsoft Office 2010 Access Tutorial 3 Maintaining and Querying a Database.
Microsoft Office 2007 Access Chapter 2 Querying a Database.
Access 2013 Microsoft Access 2013 is a database application that is ideal for gathering and understanding data that’s been collected on just about anything.
Access Manual 2 By Dhawala Kovuri Elham S.Khorasani Ismail Guneydas.
Database Systems Microsoft Access Practical #3 Queries Nos 215.
Microsoft Office 2007 Access Chapter 3 Maintaining 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.
Copyright 2008 McGraw-Hill Ryerson 1 TECHNOLOGY PLUG-IN T7 PROBLEM SOLVING USING ACCESS.
Course ILT Forms and queries Unit objectives Create forms by using AutoForm and the Form Wizard, and add or modify form headers and footers Open and enter.
® Microsoft Office 2013 Access Maintaining and Querying a Database.
Pasewark & Pasewark 1 Access Lesson 3 Creating Queries Microsoft Office 2007: Introductory.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T7: Problem Solving Using Access 2007 Business Driven Technology.
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.
1 Access Lesson 3 Creating Queries. 2 Creating a Query with the Simple Query Wizard Query-- database object that lets you ask the database about the data.
O FFICE M ANAGEMENT T OOL - II B BA -V I TH. Abdus Salam2 Week-7 Introduction to Query Introduction to Query Querying from Multiple Tables Querying from.
You can sort Access data so you can view records in the order you want to view them, and you can filter data so you only see the records you want to see.
1 Lesson 18 Managing and Reporting Database Information Computer Literacy BASICS: A Comprehensive Guide to IC 3, 3 rd Edition Morrison / Wells.
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.
USING ACCESS TO SEGMENT SURVEY DATA. OPEN ACCESS You May Need to Search for the Program You May Need to Search for the Program Access is a Database Access.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 2 ® Building Queries.
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.
Create FormsCreate Forms Lesson 5 © 2014, John Wiley & Sons, Inc.Microsoft Official Academic Course, Microsoft Access Microsoft Access 2013.
Access Queries and Forms. Adding a New Field  To insert a field after you have saved your table, open Access, and open the table  It is easier to add.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T7: Problem Solving Using Access 2007 Business Driven Technology.
Contract Compliance: Reporting
Access Maintaining and Querying a Database
Microsoft Access 2013 Bobby Wan.
Lesson 23 Managing and Reporting Database Information
Microsoft Office Illustrated Introductory, Windows Vista Edition
Practical Office 2007 Chapter 10
Access Tutorial 3 Maintaining and Querying a Database
Access Chapter 2 Querying a Database.
Analyzing Data Using Access
Microsoft Access – Tutorial 3
Plug-In T7: Problem Solving Using Access 2007
SQL MODELER - OPEN There are Three Ways to open the SQL Modeler
Access Maintaining and Querying a Database
Find and Replace Used to quickly find and/or replace data quickly
Chapter 7 Advanced Form Techniques
Lesson Four: Building Custom Patient Lists
Microsoft Office Access 2003
MODULE 7 Microsoft Access 2010
Creating and Modifying Queries
Microsoft Official Academic Course, Access 2016
Microsoft Office Access 2003
Microsoft Official Academic Course, Access 2016
Introduction to Database Programs
From and Report.
REACH Computer Resource Center
Creating complex queries using nesting
Introduction to Database Programs
Access Test Questions Test Date: 05/05/16.
Analyzing Data Using Access
Microsoft Office Illustrated Introductory, Windows XP Edition
Assignment 3 Querying and Maintaining a Database
Access Lesson 1 Microsoft Access Basics
REACH Computer Resource Center
Presentation transcript:

Queries

Queries Suppose you have a question about something in your data: Who rented “The Godfather” since we got it? Who currently has the video “Star Wars”? What videos did the user John Doe not return yet? Rather then manually looking through the database, queries will help us answer such questions.

What Are Queries? The Query objects can answer question relating the data stored in the tables Retrieve Assemble Filter Sort

What Are Queries? (2) Queries can also make calculations over data Which are the videos with a price less than 4 dollars? Queries can remove data Delete from the database all the videos of the category Action Important data can be lost by mistake. Backup!

Creating a Query There are a few different ways to create a query in Access. The simplest is to use the Query Wizard button in the Create tab. It contains some simple pre-defined queries. You can also use the Query Design button.

Query Wizard Clicking the Query Wizard button will open the New Query Window and offer a few options.

Query Wizard (2) While the Query Wizard has its uses, it is fairly limited. So instead we will show how to use the Query Design button for any type of queries we might need to create.

Under “create” we have the option of using either the Query Wizard or the Query design. The query design allows for a much more comprehensive approach.

Query Design After clicking the Query Design button, we must select the tables we need for our query. Suppose I just want to have a query that will list the customer names and their phone numbers, I would only need the Customer table.

Query Design (2)

Query Design (2) Now we need to add the “criteria” for our query. In the cells at the bottom we can select the fields we want to see by clicking the fields in the table box. We also choose rules we want our query to use. In Field, select Customer Name and Phone Number.

Query Design (3) We can test our query by clicking the Run button at the top left. The result of our query will be displayed.

Query Design (4) We can then Save our query, and it will appear in our Navigation panel at the left (which also contains the Table list). We can run the query anytime by simply by double-clicking on it.

First Name Age Weight Joe 22 55 Mary 35 45 Tom 23 39 Queries: List all the fields of people whose age is under 30.

Original table Result of Query

Note that the query result looks like a table Note that the query result looks like a table. If necessary we can make it into a table using a “make table” query.

Another query: All the people under 30 And whose weight is over 40. Age <30 AND Weight > 40 This is an AND between two “criteria” fields. Just put the conditions in each field.

Result

Another query: list all the people who are between 25 and 30 inclusive. This is an AND within a “criteria” field.

Another query: list all the people who are 25 or older OR who are heavier than 40 . This is an OR between two fields and uses the OR line..

Summary: Within a single field use “And” or “Or” “Joe” Or “Mary” >=35 And <=45 Between fields it is an “And” on the same level. For “Or” use the “Or” levels

First name = “Joe” Or ( ( Age>25) AND (Weight <50) )

First name = “Joe” Or Age>25 Or Weight <50

Calculated fields. You can create a new field in a query which is a result of computations on other fields. Note in the new field put: Age/weight: Round([Age]/[Weight],2) field name formula Note put a check in the field to display it. Note also that you can use functions.

Note new field created by query, with given name Result: Note new field created by query, with given name

To concatenate two text fields use + e.g. Whole Name: [First Name] + [ LastName]

Summing a column of numbers: Also Count, Avg (for computing averages), Min and Max These are called aggregate functions. These perform calculations on columns of data and return a single value. Open your query in datasheet view. In the Home tab Click on the Sigma.

Home tab S Totals Click on totals

When you click on S (Totals) a new line appears. The arrows give a drop down menu with possible functions for the whole column. To get rid of the extra line click the S (Totals) again

Queries on Joined Tables Consider the following two tables. You wish to ask for a list of the customers with details about the sales staff. Join the tables in a query.

We can create a query in which the tables are joined.