Download presentation
Presentation is loading. Please wait.
Published byCaren Hodges Modified over 6 years ago
1
Objectives Query for top values Create a parameter query
Modify query properties Create an update query Creating Advanced Queries Unit K
2
Objectives Create a make-table query Create an append query
Create a delete query Creating Advanced Queries Unit K
3
Introduction Queries are database objects that answer questions about the data. A select query creates a single datasheet to display the fields and records that match specific criteria An action query is one that makes changes to the data Types of action queries: delete, update, append, and make-table Creating Advanced Queries Unit K
4
Querying for Top Values
Use the Top Values feature in Query Design View to specify a number or percentage of records that you want to display. Select a subset of the highest or lowest values in a sorted query Creating Advanced Queries Unit K
5
Querying for Top Values (cont.)
Top Values list arrow Totals button Count LogNo Group By Description Creating Advanced Queries Unit K
6
Querying for Top Values (cont.)
Top Value options Creating Advanced Queries Unit K
7
Creating a Parameter Query
A parameter query displays a dialog box that prompts you for an entry. The entry is used as criteria for the query The entry narrows the number of records that appear in the datasheet Can build a form or report based on a parameter query Creating Advanced Queries Unit K
8
Creating a Parameter Query (cont.)
Parameter prompt Parameter criteria Creating Advanced Queries Unit K
9
Creating a Parameter Query (cont.)
Concatenating a parameter prompt to a wildcard character. You can concatenate (or combine) parameter prompts with a wildcard character such as an asterisk (*) to create more flexible queries The ampersand (&) is used to concatenate items in an expression Quotation marks (“”) are used to surround text criteria Creating Advanced Queries Unit K
10
Modifying Query Properties
Properties are characteristics that define the appearance and behavior of database objects, fields, and controls. View the properties for an item b opening its property sheet Creating Advanced Queries Unit K
11
Modifying Query Properties (cont.)
Click here to select the query Properties button Query properties Creating Advanced Queries Unit K
12
Creating an Update Query
An action query changes many records in one process. In order for an action query to complete its action, you must run the query using the Run button An update query is a type of action query that updates the values in a field Creating Advanced Queries Unit K
13
Creating an Update Query (cont.)
Update Query button Run button Update To: row Criteria Creating Advanced Queries Unit K
14
Creating an Update Query (cont.)
Action queries Creating Advanced Queries Unit K
15
Creating a Make-Table Query
A make-table query creates a new table of data based on the recordset defined by the query. Creates a copy of the selected data and pastes it into a new table The location of the new table can be the current or any other Access database Creating Advanced Queries Unit K
16
Creating a Make-Table Query (cont.)
Asterisk in the field list Asterisk in the query grid Date criteria Creating Advanced Queries Unit K
17
Creating a Make-Table Query (cont.)
1900 versus 2000 dates. If you type only two digits of a date, Access assumes that the digits 00 through 29 are for the years 2000 through 2029 If you type 30 through 99, Access assumes the years refer to 1930 through 1999 To specify years outside these ranges, type all four digits Creating Advanced Queries Unit K
18
Creating an Append Query
An append query adds a selected recordset by a query to an existing table called the target table Records are copied from one location and a duplicate set is pasted to another location If the target table has more fields than those you want to append, the append query will ignore the unmatched fields Creating Advanced Queries Unit K
19
Creating an Append Query (cont.)
Append Query button Append To: row Date criteria for Attended field Creating Advanced Queries Unit K
20
Creating a Delete Query
A delete query deletes a group of records from one or more tables as defined by a query. Delete queries delete entire records, not just selected fields within records Creating Advanced Queries Unit K
21
Creating a Delete Query (cont.)
Delete Query button Delete: row Creating Advanced Queries Unit K
22
Creating a Delete Query (cont.)
Reviewing referential integrity. Referential integrity between two tables is established when tables are joined It ensures that no orphaned records currently exist or are added to the database Related tables have an orphan record when information in the foreign key field of the “many” table doesn't have a matching entry in the primary key field of the “one” table Creating Advanced Queries Unit K
23
Creating a Delete Query (cont.)
Reviewing referential integrity (cont.). An orphan record is sometimes called an unmatched record The term “orphan” corresponds to the “one” table as containing parent records, and the “many” table as containing child records A child record cannot be created without a corresponding parent record Creating Advanced Queries Unit K
24
Specifying Join Properties
When more than one table’s field list is used in a query, the tables are joined as defined in the relationships window. If referential integrity is enforced, a “1” appears next to the field that serves as the “one” side of the one-to-many relationship Usually the primary key field for its table Creating Advanced Queries Unit K
25
Specifying Join Properties (cont.)
If referential integrity is enforced, an infinity sign appears next to the field that serves as the “many” side of the one-to-many relationship The foreign key field for its table Edit table relationships for an individual query in Query Design View by double-clicking the join line Creating Advanced Queries Unit K
26
Specifying Join Properties (cont.)
Double-click the join line to open the Join Properties dialog box Default join property Creating Advanced Queries Unit K
27
Specifying Join Properties (cont.)
The Join line’s appearance shows that all records in the Courses table will be included in the datasheet Creating Advanced Queries Unit K
28
Specifying Join Properties (cont.)
Finding duplicate and unmatched records. Use the Find Duplicates Query Wizard and Find Unmatched Query Wizard to help find duplicate and unmatched records Creating Advanced Queries Unit K
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.