SlideShare una empresa de Scribd logo
1 de 9
Descargar para leer sin conexión
Queries on MS Access 2010
Understanding Queries
Queries are questions you ask of your database. They allow you to select certain fields out of a table,
or pull together data from various related tables and display it together. Queries can be used to
perform calculations, and to edit the data in your tables. Queries can also form the basis of forms and
reports.
Create a Select query in Design View
1. Click the Create tab to view the Create Ribbon:
and click the Query Design button in the Queries group to create a new table in Design View.
2. The Show Table box will be displayed; add tables by double clicking them. Tables appear in
the upper “tray” of the Query Design View window; existing relationships between tables are
visible.
3. Double click field names in the tables to put them in the query. The field
appears in the grid below the “tray” where the tables appear.
a. Delete a column by clicking the column selector (thin gray rectangle
at the top of each column) and pressing the Delete key.
b. Insert a column by dragging the desired field from the Field list and
dropping in on the column where you want it to appear. Existing fields shift right to
make room.
c. Move a column by dragging it by its column selector and dropping it in its new location.
d. Hide a field by unchecking its checkbox in the Show row.
4. Click the Run button ( ) to run the query and view the results. Query results are displayed in
an answer table. A new answer table is generated each time the query is run.
5. Save the query by clicking the Save button and giving the query a name.
Notes on Query Results
 If a query contains fields from two or more related tables, the results will only include records that
have related records in all the tables. (In other words, in the query shown above, customers
without records in the Orders table will not appear in the query results.) To display such records,
use an outer join (see page 6) in your query.
 WARNING! Any change you make in a query (adding, deleting or editing data) WILL BE CHANGED
IN THE TABLES TOO!!!
Sort query results
In Design View, click the Sort row in the column you wish to sort by. A dropdown arrow appears;
choose Ascending or Descending. If you sort by more than one column, the sorts will be done left-to-
right.
Create a concatenated field in a query
Concatenated fields combine information from two or more fields into one. Ex: Combine first and last
names into one field, called “FullName”. In Design View, click in a blank column and type the following:
FullName:[FirstName]&" "&[LastName]
(Type a space between the two sets of quotation marks, and use square brackets around the field
names.)
Create a calculated field in a query
In Design View, click in a blank column and type a mathematical expression, typing field names in
square brackets. Any of the normal mathematical operators (+ - * / ^) can be used. If desired, give the
expression a name as in the sample below. The following expression calculates a total cost by
multiplying quantity times price:
Item Total:[Quantity]*[Price]
Use the Expression Builder to create calculated
or concatenated fields
You can simplify the process of creating concatenated
fields and other expressions with the Expression Builder. Create a blank column in your query grid and
then click the Builder button in the Query Setup group on the Query Design Ribbon. The Expression
Builder opens.
Type the expression in the large
box at the top. One advantage is
that you have way more room to
type and see your expression
than you have at the top of a
query grid column!
A second advantage is that you
can add fields to the expression by
double clicking them in the
Expression Categories column
rather than by typing them. This
removes the possibility of typos.
Summarize data with a Totals query
 In Query Design View, click the Totals button ( ) in the
Show/Hide group.
 A new line, called Total, will appear in the query. All the
fields will be designated “Group By”. Click the drop
down arrow in the desired field, and choose the
calculation you want (sum, average, etc.)
 Run the query.
All query fields that are not being summarized must match for the records to total properly!
(see illustration, next page.)
Specify criteria in a query (Filtering)
In Query Design View, click
in the criteria row for the
field you want to filter, and
type the criteria (ex: type
“OH” in the criteria row of
the State field). When you
run the query, only records
matching the criteria will be
displayed.
Using Multiple Criteria
You can type criteria in more than one field.
 Criteria typed on the same line must all be met for a record to be displayed (“AND” logic). Ex:
“OH” in the state field and “Smith” in the LastName field pulls up only Ohio-dwelling Smiths.
 If criteria are typed on different lines, records matching any of them will be retrieved (“OR” logic).
Ex: “WA” and “OH” on different lines in the State field retrieves records for both states.
Criteria Ranges
Criteria ranges broaden and customize a search. Type a criteria range instead of a single value in the
Criteria row of the query grid.
Criteria Example Description and Result
< <14 Finds records where the field is less than a certain value.
Records will have values under 14.
<= <= #2/2/2006# Finds records where the field is less than or equal to a
certain value.
Records will have dates on or before February 2, 2006
Note: dates are enclosed between # signs.
>
>=
>100
>=100
Similar to above: Finds records where the value is
greater than 100. The second expression displays
records where the value is greater than or equal to 100.
= =”Diana” Finds records where the value in the field is Diana.
Note: text is enclosed in double quotes.
Expressions like these may be combined - for example, a criteria of <49 Or >=100 would return records
with values below 49, or 100 or above, but not ones with values between 49 and 99.99.
Between And Between 1 and 4 Finds records where the field is between the endpoints.
Is Null Is Null Finds records where the field is empty.
Is Not Null Is Not Null Finds records where the field is not empty.
Like Like U*
Like "[U-X]*"
Like "*Korea*"
Like "*ina"
Like "Chi??"
Like "*4.99"
Finds records where the criteria match parts of the field.
The * wildcard stands for any number of characters, and
the ? wildcard stands for a single character.
The sample criteria will return records where the field
1) starts with U; 2) starts with U, V, W or X, 3) contains
the letters ‘Korea’; 4) ends in the letters ‘ina’ as in
ballerina; 5) has five letters and begins with the letters
‘Chi’ as in Chile or China; 6) is a number and ends in the
digits ‘4.99’ as in 24.99.
Create a parameter query
Parameters make queries flexible by letting users choose their own criteria each time they run the
query. In the criteria box, type a phrase in square brackets; Access will use this phrase to prompt the
user for a value. Ex: In a State field, type [Enter a state]. If the user types CA, only California
records will be retrieved.
Specify a range in a parameter query
In the criteria box, type the following:
Between [ ] And [ ]
Inside the brackets, type text telling the user what kind of information to enter.
Inner Joins vs. Outer Joins
Excel normally uses inner joins in its queries. These queries return only those rows from both tables in
the join that match on the joining field (e.g., customers in the Customers table with corresponding
orders in the Orders table.)
If you need to display all customers, with or without orders, as well as any available order information,
you need to use an outer join.
In the query tray, double click the join line between two related tables. The Join Properties dialog
box will appear:
Select button 2 or 3 depending on which field’s records you want to display completely.
Action Queries
Action queries modify groups of records in one fell swoop. Types of action queries include:
 Update Queries (modify all records in a table that meet specific criteria – ex: change the tax rate
for all Ohio customers from 5.75% to 6%)
 Delete Queries (remove records from a table – ex: delete all customers whose last order date
is more than 2 years ago)
 Append Queries (add records to an existing table – ex: at the end of the year, add the year's
orders to the end of an archive table)
 Make-table Queries (create a new table – ex: extract a subset of records into a new table, for
a subordinate who needs Ohio customers only)
Note: Undo will NOT undo the results of action queries!
Create an update query
1. Create a new table in Design View. Add the table you will be updating.
2. Add the following fields to the query:
a. The field you will be updating and
b. The fields you need as criteria.
For example, if you are changing the sales tax for all businesses in Cuyahoga County, you
would need to add a Sales Tax field and a County field to your query.
3. Change the query type to an update query by clicking the Update button in the Query Type group
on the Query Tools Design toolbar:
4. In the Criteria row of the query, type criteria to select the records that will be changed.
5. In the Update To row of the query, add an expression to update the desired fields.
(example: [Price]*1.1 will raise all the values in the Price field by 10%.)
(Note: You can use parameters in the Criteria and/or Update To rows.)
6. Click the View button ( ) to preview records that will be affected; click it again ( )
to return to design view.
7. Click Run to run the query. Access will show a warning box telling you how many records it
will modify; click Yes to continue updating the records.
Other Specialized Queries
Instructions for creating and running these special query types can be found in the Access help
manual by clicking the Help button in the upper right corner of the screen (Internet connection
required).
Find Duplicates query: Lets you locate duplicate records in a table by displaying a field containing
duplicate values alongside other fields for comparison, to help you tell if the record is really a
duplicate.
Find Unmatched query: Lets you compare two tables and identify records in one of the tables that
have no corresponding records in the other table.
Crosstab query: This is a special type of Totals query that presents summary information in a
compact format that is similar to a spreadsheet.
Union query: Lets you review all of the data that is returned by several similar select queries together,
as a combined set.
Practice Assignment:
1. Open your “NEOhio Outreach” database. Create a query that pulls up each donor’s contributions:
a. Create a new query in Design View (click the Create tab and click the Query Design button in
the Other group).
b. Select and add the following tables: Contributions and Donors; close the Show Table box.
c. Add the following fields into the query: all fields from the Contributions table (use the * to
add all fields at once!), and the Last Name, First Name, Address, City, State and Zip fields
from the Donors table. (The only fields you are leaving out are the Donor ID and Phone
Number fields from the Donors table.)
d. Sort the query into ascending order by last name, then within each last name, sort
into ascending order by first name.
e. Save the query as Donor Statements. Run the query to be sure it works, then close the query.
2. Create a query that selects a list of donors and calculates the total contribution and average
contribution amounts for each donor. Set parameters that enable the user to choose a date
range. a. From within your “NEOhio Outreach” database, create a new query in Design View.
Select and add the following tables: Contributions and Donors; close the Show Table box.
b. Add the Last Name field, and set the query to sort by this field, but not to display it. In the
next column, create a Full Name field that will show both the first name and the last name.
Click Run to check that only the Full Name field is displayed. Return to Design View.
c. Place the Amount field in each of the next two columns, then click the Totals button. In the first
Amount field, calculate the Sum; in the second one, calculate the Average.
d. Place the Date field in the next column, and choose where in the Total row. In the criteria
row, type an expression that will select dates between a user-entered starting date and
ending date.
e. Save your query as Contribution Report.

Más contenido relacionado

La actualidad más candente

ms excel presentation...
ms excel presentation...ms excel presentation...
ms excel presentation...alok1994
 
Ms excel basic about Data, graph and pivot table
Ms excel basic about Data, graph and pivot table Ms excel basic about Data, graph and pivot table
Ms excel basic about Data, graph and pivot table Alomgir Hossain
 
An introduction to microsoft office 2007 lecture
An introduction to microsoft office 2007 lectureAn introduction to microsoft office 2007 lecture
An introduction to microsoft office 2007 lectureSukh Sandhu
 
Introduction to microsoft access
Introduction to microsoft accessIntroduction to microsoft access
Introduction to microsoft accessHardik Patel
 
Microsoft Power Point 2007 (Basics)
Microsoft Power Point 2007 (Basics)Microsoft Power Point 2007 (Basics)
Microsoft Power Point 2007 (Basics)NikitaSharma332
 
Training On Microsoft Excel
Training On Microsoft ExcelTraining On Microsoft Excel
Training On Microsoft ExcelTimesRide
 
Microsoft Excel Basics
Microsoft Excel BasicsMicrosoft Excel Basics
Microsoft Excel BasicsCompudon
 
Ms access basics ppt
Ms access basics ppt Ms access basics ppt
Ms access basics ppt vethics
 
Ms Access ppt
Ms Access pptMs Access ppt
Ms Access pptanuj
 
Chapter 4 microsoft access 2010
Chapter 4 microsoft access 2010Chapter 4 microsoft access 2010
Chapter 4 microsoft access 2010home
 

La actualidad más candente (20)

ms excel presentation...
ms excel presentation...ms excel presentation...
ms excel presentation...
 
Basic Ms excel
Basic Ms excelBasic Ms excel
Basic Ms excel
 
Ms access
Ms accessMs access
Ms access
 
Excel lesson01
Excel lesson01Excel lesson01
Excel lesson01
 
Ms excel basic about Data, graph and pivot table
Ms excel basic about Data, graph and pivot table Ms excel basic about Data, graph and pivot table
Ms excel basic about Data, graph and pivot table
 
MS Word Basics Training
MS Word Basics TrainingMS Word Basics Training
MS Word Basics Training
 
Ms access
Ms accessMs access
Ms access
 
Ms access 2010
Ms access 2010Ms access 2010
Ms access 2010
 
An introduction to microsoft office 2007 lecture
An introduction to microsoft office 2007 lectureAn introduction to microsoft office 2007 lecture
An introduction to microsoft office 2007 lecture
 
Introduction to microsoft access
Introduction to microsoft accessIntroduction to microsoft access
Introduction to microsoft access
 
Microsoft Power Point 2007 (Basics)
Microsoft Power Point 2007 (Basics)Microsoft Power Point 2007 (Basics)
Microsoft Power Point 2007 (Basics)
 
Introduction to ms access database
Introduction to ms access databaseIntroduction to ms access database
Introduction to ms access database
 
Microsoft power point 2007
Microsoft power point 2007Microsoft power point 2007
Microsoft power point 2007
 
Training On Microsoft Excel
Training On Microsoft ExcelTraining On Microsoft Excel
Training On Microsoft Excel
 
Microsoft Excel Basics
Microsoft Excel BasicsMicrosoft Excel Basics
Microsoft Excel Basics
 
Ms access basics ppt
Ms access basics ppt Ms access basics ppt
Ms access basics ppt
 
Presentation
PresentationPresentation
Presentation
 
Ms Access ppt
Ms Access pptMs Access ppt
Ms Access ppt
 
Microsoft Excel Basics
Microsoft Excel BasicsMicrosoft Excel Basics
Microsoft Excel Basics
 
Chapter 4 microsoft access 2010
Chapter 4 microsoft access 2010Chapter 4 microsoft access 2010
Chapter 4 microsoft access 2010
 

Destacado

Starting ms access 2010
Starting ms access 2010Starting ms access 2010
Starting ms access 2010Bryan Corpuz
 
Report for Final Project in MS Access
Report for Final Project in MS AccessReport for Final Project in MS Access
Report for Final Project in MS AccessSheila DeLaney
 
Using Indexed field effectively in Access Queries with Voyager
Using Indexed field effectively in Access Queries with VoyagerUsing Indexed field effectively in Access Queries with Voyager
Using Indexed field effectively in Access Queries with VoyagerAlan Manifold
 
Ms access 2010 lesson 3 (Interface)
Ms access 2010 lesson 3 (Interface)Ms access 2010 lesson 3 (Interface)
Ms access 2010 lesson 3 (Interface)teng113
 
New Perspectives: Access.04
New Perspectives: Access.04New Perspectives: Access.04
New Perspectives: Access.04Anna Stirling
 
New Perspectives: Access.05
New Perspectives: Access.05New Perspectives: Access.05
New Perspectives: Access.05Anna Stirling
 
MS Access and Database Fundamentals
MS Access and Database FundamentalsMS Access and Database Fundamentals
MS Access and Database FundamentalsAnanda Gupta
 
Database Design Slide 1
Database Design Slide 1Database Design Slide 1
Database Design Slide 1ahfiki
 

Destacado (12)

Starting ms access 2010
Starting ms access 2010Starting ms access 2010
Starting ms access 2010
 
Report for Final Project in MS Access
Report for Final Project in MS AccessReport for Final Project in MS Access
Report for Final Project in MS Access
 
Using Indexed field effectively in Access Queries with Voyager
Using Indexed field effectively in Access Queries with VoyagerUsing Indexed field effectively in Access Queries with Voyager
Using Indexed field effectively in Access Queries with Voyager
 
MS Access 2010 tutorial 3
MS Access 2010 tutorial 3MS Access 2010 tutorial 3
MS Access 2010 tutorial 3
 
Alan vs the BLOB
Alan vs the BLOBAlan vs the BLOB
Alan vs the BLOB
 
Ms access 2010 lesson 3 (Interface)
Ms access 2010 lesson 3 (Interface)Ms access 2010 lesson 3 (Interface)
Ms access 2010 lesson 3 (Interface)
 
New Perspectives: Access.04
New Perspectives: Access.04New Perspectives: Access.04
New Perspectives: Access.04
 
New Perspectives: Access.05
New Perspectives: Access.05New Perspectives: Access.05
New Perspectives: Access.05
 
MS Access and Database Fundamentals
MS Access and Database FundamentalsMS Access and Database Fundamentals
MS Access and Database Fundamentals
 
Ms access
Ms accessMs access
Ms access
 
Database Design Slide 1
Database Design Slide 1Database Design Slide 1
Database Design Slide 1
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
 

Similar a MS Access 2010 tutorial 5

Fill series. Data validation. Excel Tutorial
Fill series. Data validation. Excel TutorialFill series. Data validation. Excel Tutorial
Fill series. Data validation. Excel TutorialIlgar Zarbaliyev
 
Excel notes by satish kumar avunoori
Excel notes by satish kumar avunooriExcel notes by satish kumar avunoori
Excel notes by satish kumar avunooriSatish Kumar
 
4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf
4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf
4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdfNitish Nagar
 
Crosstab query techniques
Crosstab query techniquesCrosstab query techniques
Crosstab query techniquesaabaap
 
Customizing Forms
Customizing FormsCustomizing Forms
Customizing FormsEMAINT
 
D I T211 Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)D I T211    Chapter 5 ( Lab 3)
D I T211 Chapter 5 ( Lab 3)askme
 
Class viii ch-4 working with queries
Class  viii ch-4 working with queriesClass  viii ch-4 working with queries
Class viii ch-4 working with queriesjessandy
 
Microsoft Office Excel 2003 Sorting And Filtering
Microsoft Office Excel 2003 Sorting And FilteringMicrosoft Office Excel 2003 Sorting And Filtering
Microsoft Office Excel 2003 Sorting And FilteringMarc Morgenstern
 
Easy Pivot Tutorial June 2020
Easy Pivot Tutorial June 2020Easy Pivot Tutorial June 2020
Easy Pivot Tutorial June 2020Adhi Wikantyoso
 
Filter Data in Excel Services SharePoint 2010 - EPC Group
Filter Data in Excel Services SharePoint 2010 - EPC GroupFilter Data in Excel Services SharePoint 2010 - EPC Group
Filter Data in Excel Services SharePoint 2010 - EPC GroupEPC Group
 
Splitter Pro X version Tutorial June 2020 English
Splitter Pro X version Tutorial June 2020 EnglishSplitter Pro X version Tutorial June 2020 English
Splitter Pro X version Tutorial June 2020 EnglishAdhi Wikantyoso
 
Operate Spreadsheet applications ppt.pptx
Operate Spreadsheet applications ppt.pptxOperate Spreadsheet applications ppt.pptx
Operate Spreadsheet applications ppt.pptxEsubalew21
 
EX19_AC_CH03_GRADER_HOE_AS_InstructionsGrader - Instructi
EX19_AC_CH03_GRADER_HOE_AS_InstructionsGrader - InstructiEX19_AC_CH03_GRADER_HOE_AS_InstructionsGrader - Instructi
EX19_AC_CH03_GRADER_HOE_AS_InstructionsGrader - InstructiBetseyCalderon89
 
MS Access Ch 2 PPT
MS Access Ch 2 PPTMS Access Ch 2 PPT
MS Access Ch 2 PPTprsmith72
 
Chapter 29Foundations of Family CareFamily DefinedT.docx
Chapter 29Foundations of Family CareFamily DefinedT.docxChapter 29Foundations of Family CareFamily DefinedT.docx
Chapter 29Foundations of Family CareFamily DefinedT.docxcravennichole326
 

Similar a MS Access 2010 tutorial 5 (20)

Fill series. Data validation. Excel Tutorial
Fill series. Data validation. Excel TutorialFill series. Data validation. Excel Tutorial
Fill series. Data validation. Excel Tutorial
 
Excel notes by satish kumar avunoori
Excel notes by satish kumar avunooriExcel notes by satish kumar avunoori
Excel notes by satish kumar avunoori
 
Advanced Excel ppt
Advanced Excel pptAdvanced Excel ppt
Advanced Excel ppt
 
4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf
4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf
4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf
 
Crosstab query techniques
Crosstab query techniquesCrosstab query techniques
Crosstab query techniques
 
Toa study guide
Toa study guideToa study guide
Toa study guide
 
Customizing Forms
Customizing FormsCustomizing Forms
Customizing Forms
 
D I T211 Chapter 5 ( Lab 3)
D I T211    Chapter 5 ( Lab 3)D I T211    Chapter 5 ( Lab 3)
D I T211 Chapter 5 ( Lab 3)
 
003.query
003.query003.query
003.query
 
Class viii ch-4 working with queries
Class  viii ch-4 working with queriesClass  viii ch-4 working with queries
Class viii ch-4 working with queries
 
Microsoft Office Excel 2003 Sorting And Filtering
Microsoft Office Excel 2003 Sorting And FilteringMicrosoft Office Excel 2003 Sorting And Filtering
Microsoft Office Excel 2003 Sorting And Filtering
 
Easy Pivot Tutorial June 2020
Easy Pivot Tutorial June 2020Easy Pivot Tutorial June 2020
Easy Pivot Tutorial June 2020
 
Filter Data in Excel Services SharePoint 2010 - EPC Group
Filter Data in Excel Services SharePoint 2010 - EPC GroupFilter Data in Excel Services SharePoint 2010 - EPC Group
Filter Data in Excel Services SharePoint 2010 - EPC Group
 
Splitter Pro X version Tutorial June 2020 English
Splitter Pro X version Tutorial June 2020 EnglishSplitter Pro X version Tutorial June 2020 English
Splitter Pro X version Tutorial June 2020 English
 
Operate Spreadsheet applications ppt.pptx
Operate Spreadsheet applications ppt.pptxOperate Spreadsheet applications ppt.pptx
Operate Spreadsheet applications ppt.pptx
 
EX19_AC_CH03_GRADER_HOE_AS_InstructionsGrader - Instructi
EX19_AC_CH03_GRADER_HOE_AS_InstructionsGrader - InstructiEX19_AC_CH03_GRADER_HOE_AS_InstructionsGrader - Instructi
EX19_AC_CH03_GRADER_HOE_AS_InstructionsGrader - Instructi
 
MS Access Ch 2 PPT
MS Access Ch 2 PPTMS Access Ch 2 PPT
MS Access Ch 2 PPT
 
OpenCastLabs Excel chapter-3
OpenCastLabs Excel chapter-3OpenCastLabs Excel chapter-3
OpenCastLabs Excel chapter-3
 
Chapter 29Foundations of Family CareFamily DefinedT.docx
Chapter 29Foundations of Family CareFamily DefinedT.docxChapter 29Foundations of Family CareFamily DefinedT.docx
Chapter 29Foundations of Family CareFamily DefinedT.docx
 
MS Excel 2013
MS Excel 2013MS Excel 2013
MS Excel 2013
 

Más de Khalfan Alshuaili

Más de Khalfan Alshuaili (20)

MS Word 2010 tutorial 6
MS Word 2010 tutorial 6MS Word 2010 tutorial 6
MS Word 2010 tutorial 6
 
MS Excel 2010 tutorial 1
MS Excel 2010 tutorial 1MS Excel 2010 tutorial 1
MS Excel 2010 tutorial 1
 
MS Excel 2010 tutorial 2
MS Excel 2010 tutorial 2MS Excel 2010 tutorial 2
MS Excel 2010 tutorial 2
 
MS Word 2010 tutorial 5
MS Word 2010 tutorial 5MS Word 2010 tutorial 5
MS Word 2010 tutorial 5
 
MS Word 2010 tutorial 4
MS Word 2010 tutorial 4MS Word 2010 tutorial 4
MS Word 2010 tutorial 4
 
MS Word 2010 tutorial 3
MS Word 2010 tutorial 3MS Word 2010 tutorial 3
MS Word 2010 tutorial 3
 
MS Word 2010 tutorial 2
MS Word 2010 tutorial 2MS Word 2010 tutorial 2
MS Word 2010 tutorial 2
 
MS Word 2010 tutorial 1
MS Word 2010 tutorial 1MS Word 2010 tutorial 1
MS Word 2010 tutorial 1
 
MS PowerPoint 2010 tutorial 6
MS PowerPoint 2010 tutorial 6MS PowerPoint 2010 tutorial 6
MS PowerPoint 2010 tutorial 6
 
MS PowerPoint 2010 tutorial 5
MS PowerPoint 2010 tutorial 5MS PowerPoint 2010 tutorial 5
MS PowerPoint 2010 tutorial 5
 
MS PowerPoint 2010 tutorial 4
MS PowerPoint 2010 tutorial 4MS PowerPoint 2010 tutorial 4
MS PowerPoint 2010 tutorial 4
 
MS PowerPoint 2010 tutorial 3
MS PowerPoint 2010 tutorial 3MS PowerPoint 2010 tutorial 3
MS PowerPoint 2010 tutorial 3
 
MS PowerPoint 2010 tutorial 2
MS PowerPoint 2010 tutorial 2MS PowerPoint 2010 tutorial 2
MS PowerPoint 2010 tutorial 2
 
MS PowerPoint 2010 tutorial 1
MS PowerPoint 2010 tutorial 1MS PowerPoint 2010 tutorial 1
MS PowerPoint 2010 tutorial 1
 
MS Excel 2010 tutorial 6
MS Excel 2010 tutorial 6MS Excel 2010 tutorial 6
MS Excel 2010 tutorial 6
 
MS Excel 2010 tutorial 5
MS Excel 2010 tutorial 5MS Excel 2010 tutorial 5
MS Excel 2010 tutorial 5
 
MS Excel 2010 tutorial 4
MS Excel 2010 tutorial 4MS Excel 2010 tutorial 4
MS Excel 2010 tutorial 4
 
MS Excel 2010 tutorial 3
MS Excel 2010 tutorial 3MS Excel 2010 tutorial 3
MS Excel 2010 tutorial 3
 
MS Access 2010 tutorial 6
MS Access 2010 tutorial 6MS Access 2010 tutorial 6
MS Access 2010 tutorial 6
 
MS Access 2010 tutorial 4
MS Access 2010 tutorial 4MS Access 2010 tutorial 4
MS Access 2010 tutorial 4
 

Último

Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 

Último (20)

Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 

MS Access 2010 tutorial 5

  • 1. Queries on MS Access 2010 Understanding Queries Queries are questions you ask of your database. They allow you to select certain fields out of a table, or pull together data from various related tables and display it together. Queries can be used to perform calculations, and to edit the data in your tables. Queries can also form the basis of forms and reports. Create a Select query in Design View 1. Click the Create tab to view the Create Ribbon: and click the Query Design button in the Queries group to create a new table in Design View. 2. The Show Table box will be displayed; add tables by double clicking them. Tables appear in the upper “tray” of the Query Design View window; existing relationships between tables are visible.
  • 2. 3. Double click field names in the tables to put them in the query. The field appears in the grid below the “tray” where the tables appear. a. Delete a column by clicking the column selector (thin gray rectangle at the top of each column) and pressing the Delete key. b. Insert a column by dragging the desired field from the Field list and dropping in on the column where you want it to appear. Existing fields shift right to make room. c. Move a column by dragging it by its column selector and dropping it in its new location. d. Hide a field by unchecking its checkbox in the Show row. 4. Click the Run button ( ) to run the query and view the results. Query results are displayed in an answer table. A new answer table is generated each time the query is run. 5. Save the query by clicking the Save button and giving the query a name. Notes on Query Results  If a query contains fields from two or more related tables, the results will only include records that have related records in all the tables. (In other words, in the query shown above, customers without records in the Orders table will not appear in the query results.) To display such records, use an outer join (see page 6) in your query.  WARNING! Any change you make in a query (adding, deleting or editing data) WILL BE CHANGED IN THE TABLES TOO!!! Sort query results In Design View, click the Sort row in the column you wish to sort by. A dropdown arrow appears; choose Ascending or Descending. If you sort by more than one column, the sorts will be done left-to- right.
  • 3. Create a concatenated field in a query Concatenated fields combine information from two or more fields into one. Ex: Combine first and last names into one field, called “FullName”. In Design View, click in a blank column and type the following: FullName:[FirstName]&" "&[LastName] (Type a space between the two sets of quotation marks, and use square brackets around the field names.) Create a calculated field in a query In Design View, click in a blank column and type a mathematical expression, typing field names in square brackets. Any of the normal mathematical operators (+ - * / ^) can be used. If desired, give the expression a name as in the sample below. The following expression calculates a total cost by multiplying quantity times price: Item Total:[Quantity]*[Price] Use the Expression Builder to create calculated or concatenated fields You can simplify the process of creating concatenated fields and other expressions with the Expression Builder. Create a blank column in your query grid and then click the Builder button in the Query Setup group on the Query Design Ribbon. The Expression Builder opens. Type the expression in the large box at the top. One advantage is that you have way more room to type and see your expression than you have at the top of a query grid column! A second advantage is that you can add fields to the expression by double clicking them in the Expression Categories column rather than by typing them. This removes the possibility of typos.
  • 4. Summarize data with a Totals query  In Query Design View, click the Totals button ( ) in the Show/Hide group.  A new line, called Total, will appear in the query. All the fields will be designated “Group By”. Click the drop down arrow in the desired field, and choose the calculation you want (sum, average, etc.)  Run the query. All query fields that are not being summarized must match for the records to total properly! (see illustration, next page.)
  • 5. Specify criteria in a query (Filtering) In Query Design View, click in the criteria row for the field you want to filter, and type the criteria (ex: type “OH” in the criteria row of the State field). When you run the query, only records matching the criteria will be displayed. Using Multiple Criteria You can type criteria in more than one field.  Criteria typed on the same line must all be met for a record to be displayed (“AND” logic). Ex: “OH” in the state field and “Smith” in the LastName field pulls up only Ohio-dwelling Smiths.  If criteria are typed on different lines, records matching any of them will be retrieved (“OR” logic). Ex: “WA” and “OH” on different lines in the State field retrieves records for both states. Criteria Ranges Criteria ranges broaden and customize a search. Type a criteria range instead of a single value in the Criteria row of the query grid. Criteria Example Description and Result < <14 Finds records where the field is less than a certain value. Records will have values under 14. <= <= #2/2/2006# Finds records where the field is less than or equal to a certain value. Records will have dates on or before February 2, 2006 Note: dates are enclosed between # signs. > >= >100 >=100 Similar to above: Finds records where the value is greater than 100. The second expression displays records where the value is greater than or equal to 100. = =”Diana” Finds records where the value in the field is Diana. Note: text is enclosed in double quotes. Expressions like these may be combined - for example, a criteria of <49 Or >=100 would return records with values below 49, or 100 or above, but not ones with values between 49 and 99.99.
  • 6. Between And Between 1 and 4 Finds records where the field is between the endpoints. Is Null Is Null Finds records where the field is empty. Is Not Null Is Not Null Finds records where the field is not empty. Like Like U* Like "[U-X]*" Like "*Korea*" Like "*ina" Like "Chi??" Like "*4.99" Finds records where the criteria match parts of the field. The * wildcard stands for any number of characters, and the ? wildcard stands for a single character. The sample criteria will return records where the field 1) starts with U; 2) starts with U, V, W or X, 3) contains the letters ‘Korea’; 4) ends in the letters ‘ina’ as in ballerina; 5) has five letters and begins with the letters ‘Chi’ as in Chile or China; 6) is a number and ends in the digits ‘4.99’ as in 24.99. Create a parameter query Parameters make queries flexible by letting users choose their own criteria each time they run the query. In the criteria box, type a phrase in square brackets; Access will use this phrase to prompt the user for a value. Ex: In a State field, type [Enter a state]. If the user types CA, only California records will be retrieved. Specify a range in a parameter query In the criteria box, type the following: Between [ ] And [ ] Inside the brackets, type text telling the user what kind of information to enter. Inner Joins vs. Outer Joins Excel normally uses inner joins in its queries. These queries return only those rows from both tables in the join that match on the joining field (e.g., customers in the Customers table with corresponding orders in the Orders table.) If you need to display all customers, with or without orders, as well as any available order information, you need to use an outer join. In the query tray, double click the join line between two related tables. The Join Properties dialog box will appear:
  • 7. Select button 2 or 3 depending on which field’s records you want to display completely. Action Queries Action queries modify groups of records in one fell swoop. Types of action queries include:  Update Queries (modify all records in a table that meet specific criteria – ex: change the tax rate for all Ohio customers from 5.75% to 6%)  Delete Queries (remove records from a table – ex: delete all customers whose last order date is more than 2 years ago)  Append Queries (add records to an existing table – ex: at the end of the year, add the year's orders to the end of an archive table)  Make-table Queries (create a new table – ex: extract a subset of records into a new table, for a subordinate who needs Ohio customers only) Note: Undo will NOT undo the results of action queries! Create an update query 1. Create a new table in Design View. Add the table you will be updating. 2. Add the following fields to the query: a. The field you will be updating and b. The fields you need as criteria. For example, if you are changing the sales tax for all businesses in Cuyahoga County, you would need to add a Sales Tax field and a County field to your query. 3. Change the query type to an update query by clicking the Update button in the Query Type group on the Query Tools Design toolbar: 4. In the Criteria row of the query, type criteria to select the records that will be changed. 5. In the Update To row of the query, add an expression to update the desired fields. (example: [Price]*1.1 will raise all the values in the Price field by 10%.) (Note: You can use parameters in the Criteria and/or Update To rows.) 6. Click the View button ( ) to preview records that will be affected; click it again ( ) to return to design view.
  • 8. 7. Click Run to run the query. Access will show a warning box telling you how many records it will modify; click Yes to continue updating the records. Other Specialized Queries Instructions for creating and running these special query types can be found in the Access help manual by clicking the Help button in the upper right corner of the screen (Internet connection required). Find Duplicates query: Lets you locate duplicate records in a table by displaying a field containing duplicate values alongside other fields for comparison, to help you tell if the record is really a duplicate. Find Unmatched query: Lets you compare two tables and identify records in one of the tables that have no corresponding records in the other table. Crosstab query: This is a special type of Totals query that presents summary information in a compact format that is similar to a spreadsheet. Union query: Lets you review all of the data that is returned by several similar select queries together, as a combined set.
  • 9. Practice Assignment: 1. Open your “NEOhio Outreach” database. Create a query that pulls up each donor’s contributions: a. Create a new query in Design View (click the Create tab and click the Query Design button in the Other group). b. Select and add the following tables: Contributions and Donors; close the Show Table box. c. Add the following fields into the query: all fields from the Contributions table (use the * to add all fields at once!), and the Last Name, First Name, Address, City, State and Zip fields from the Donors table. (The only fields you are leaving out are the Donor ID and Phone Number fields from the Donors table.) d. Sort the query into ascending order by last name, then within each last name, sort into ascending order by first name. e. Save the query as Donor Statements. Run the query to be sure it works, then close the query. 2. Create a query that selects a list of donors and calculates the total contribution and average contribution amounts for each donor. Set parameters that enable the user to choose a date range. a. From within your “NEOhio Outreach” database, create a new query in Design View. Select and add the following tables: Contributions and Donors; close the Show Table box. b. Add the Last Name field, and set the query to sort by this field, but not to display it. In the next column, create a Full Name field that will show both the first name and the last name. Click Run to check that only the Full Name field is displayed. Return to Design View. c. Place the Amount field in each of the next two columns, then click the Totals button. In the first Amount field, calculate the Sum; in the second one, calculate the Average. d. Place the Date field in the next column, and choose where in the Total row. In the criteria row, type an expression that will select dates between a user-entered starting date and ending date. e. Save your query as Contribution Report.