lesson 33: creating complex queries

12
Lesson 33: Creating Complex Queries

Upload: fonda

Post on 23-Feb-2016

36 views

Category:

Documents


1 download

DESCRIPTION

Lesson 33: Creating Complex Queries. Lesson Objectives. After studying this lesson, you will be able to: Create a select query involving multiple tables Create a report based on multiple tables in a query Create and run parameter queries Create a calculated field in a query - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Lesson 33: Creating Complex Queries

Lesson 33: Creating Complex Queries

Page 2: Lesson 33: Creating Complex Queries

2

Lesson Objectives After studying this lesson, you will be able to:

Create a select query involving multiple tables Create a report based on multiple tables in a query

Create and run parameter queries Create a calculated field in a query Create and run action queries Analyze, compact, repair, backup, and restore a

database

Page 3: Lesson 33: Creating Complex Queries

Access Query Types Select Query Crosstab Query Unmatched Query Duplicates Query Parameter Query Action Query SQL Query

3

Page 4: Lesson 33: Creating Complex Queries

Working with Relationships

4

When relationships are missing, querying a database using fields from multiple tables creates unexpected, meaningless results

These results are called Cartesian products Each record is listed multiple times

Page 5: Lesson 33: Creating Complex Queries

Parameter Queries Prompt users for input to narrow the query output Criteria expression contains prompt text

Criteria expression appears in the query grid Criteria row

Criteria expression prompts user for a value when the query is run

Tip! Brackets always surround the criteria expression.

5

Page 6: Lesson 33: Creating Complex Queries

Working with Calculated Controls Calculated fields can be used to combine text strings

Last Name: Brown First Name: Samuel Name: [First Name] + [Last Name]=Samuel Brown

Calculated fields are constructed as follows: New Field Name: [Existing Field Name] Operation

[Existing Field Name]

6

Page 7: Lesson 33: Creating Complex Queries

Action Queries Delete Query

Deletes a group of records from one or more tables Update Query

Makes global changes to a group of records in one or more tables

Append Query Adds a group of records from one or more tables to the

end of one or more tables Make-Table Query

Creates a new table from all or selected data in one or more tables

Page 8: Lesson 33: Creating Complex Queries

Setting Up an Action Query Each action query has a source and destination table Action types are set using Query Type controls on the

RibbonAction query types

Source table is the active table; destination table identified in the dialog box

Page 9: Lesson 33: Creating Complex Queries

Analyzing and Documenting Databases Performance Analyzer

Reviews structures of database objects Identifies potential trouble spots/objects Reports the results of the analysis Ensures smooth functioning of the database

Database Documenter Reviews all database objects Documents all objects and their associations Includes field names and other significant

information

Page 10: Lesson 33: Creating Complex Queries

10

Backing Up & Compacting Databases Backing up a database

Makes a duplicate of the database for easy retrieval Adds the data to the filename each time you back up

Compacting and repairing a database Optimizes database performance Identifies problems with a database that could corrupt it

and attempts to fix the problem No new file is created when you compact and repair

Page 11: Lesson 33: Creating Complex Queries

Adding Totals to Datasheets Enables you total any datasheet column Total appears at the bottom of the datasheet column Functions such as Sum, Min, Max, and Avg are

available for totaling columns

11

Page 12: Lesson 33: Creating Complex Queries

Lesson 33: Creating Complex Queries