Download presentation
Presentation is loading. Please wait.
Published byHeather Wood Modified over 9 years ago
1
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-1 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 ADVANCED QUERY TECHNIQUES Microsoft Access 2007 – Level 2 Chapter 3
2
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-2 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Performance Objectives Save a filter as a query Create and run a parameter query to prompt for criteria Add and remove tables to and from a query Create an inner join, left join, and right join to modify query results Create a self-join to match two fields in the same table Create a query that includes a subquery Assign an alias to a table and a field name Select records using a multi-valued field in a query Create a new table using a make-table query Remove records from a table using a delete query Add records to the end of an existing table using an append query Modify records using an update query
3
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-3 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Save a Filter as a Query 1. Open the table and filter as desired 2. Click then 4. click same 3. Set desired criteria 5. Name the query and click OK
4
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-4 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Creating a Parameter Query Open a query in Design view; type each prompt enclosed in square brackets [ ] into a Criteria cell or field Prompts for information when the query runs Hint: make the prompt self-explanatory
5
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-5 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Creating a Parameter Query.../2 Run the query, responding to prompts Type as directed by prompt and click OK Query result – only those records that match both (Case-insensitive) Name and save the query as desired
6
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-6 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Modifying Joins in a Query Relationships between tables may have been set in the Relationships window; those joins may be overridden during a query Create a query and show the desired tables; Access will insert a Join line as set up 1) in the Relationships window or 2) when creating Lookup fields
7
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-7 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Modifying Joins in a Query.../2 To change the Join, choose a different option in the Join dialog box In query design, double-click the join line Choose desired option and click OK Inner join Left outer join Right outer join
8
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-8 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Modifying Joins in a Query.../3 Example of an Inner Join Only records that have matching fields in both tables will be displayed Notice missing records
9
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-9 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Modifying Joins in a Query.../4 Example of a Left Outer Join All records from the primary table and those that match from the secondary table Notice null fields
10
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-10 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Modifying Joins in a Query.../5 Example of a Right Outer Join All records from the secondary table and those that match from the primary table Notice null fields
11
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-11 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Creating a Self-Join Joining Two Copies of the Same Table in a Query Table must have matching values in two separate fields 1. Create Join line between fields 2. Insert fields from both tables into the grid 3. To change the name, right-click a field and choose Properties 4. Type into the Caption property
12
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-12 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 A Query with No Established Relationship A query created from two tables with no join line produces a cross product or Cartesian product query; it produces a datasheet with every combination of records between the two tables Hint: Always review the join lines!
13
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-13 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Creating a Custom Calculation A calculated field displays the result of an expression rather than displaying stored data Enter an expression into an empty field cell in the query design grid Enclose field names in brackets Characters before the colon become the column name Right-click the field cell to change its Format property
14
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-14 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Creating and Using Subqueries A subquery is a nested query inside another query Use for any combination of fields that will be used in multiple queries Create and save the query to be nested Create a new query and click the Show Table button Add tables and queries as desired Be sure to review the joins!
15
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-15 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Query with a Multi-Valued Field In query design, determine how the multi-valued field should be displayed Table containing the multi-value field has two entries for the field
16
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-16 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Creating an Alias for a Table or Field Can change the table name for use in a query without changing it for all other objects (queries, forms, reports, etc.) In query design view, right-click the table and choose Properties Remove the existing Alias text and type the desired alias
17
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-17 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Creating an Action Query To perform an operation on a selected group of records Action QueryDescription Make TableCreates a new table from selected data in one or more other tables DeleteDeletes selected records from one or more tables AppendCopies selected records from one or more tables to the end of one or more tables UpdateMakes changes to selected records from one or more tables Caution! After running an action query, its action cannot be undone!
18
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-18 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Creating an Action Query…/2 Steps to creating and running an action query 1. Build and run a select query with tables, fields, criteria, and sort order 2. Change the query type 3. Run the action query once only
19
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-19 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Creating a Make-Table Query Enter the table name Click Choose the current or another database and name it or Browse In Query Design view, after creating a Select query to verify the records, click the Make Table button
20
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-20 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Creating a Make-Table Query…/2 Review the message and click Yes Click the Run button to perform the query then Save and close the query
21
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-21 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Creating a Delete Query Read the message and click Yes Click the Run button to run the query In Query Design view, after creating a Select query to verify the records, click the Delete button The View button previews records to be deleted; the Run button deletes the records permanently
22
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-22 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Creating an Append Query Enter the table name Click Choose the current or another database and name it or Browse In Query Design view, after creating a Select query to verify the records, click the Append button
23
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-23 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Creating an Append Query.../2 Review the message and click Yes Click the Run button to perform the query Save and close the query The query and the receiving table must have the same structure
24
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-24 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Creating an Update Query In the new row, in the column to be updated, enter the text or expression that will replace the contents of this field In Query Design view, after creating a Select query to verify the records, click the Update button
25
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-25 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Creating an Update Query…/2 Review the message and click Yes Click the Run button to perform the query Save and close the query The update expression must have the same data type as the original field
26
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-26 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 How do you save a filter as a query? Features Summary 1. After filtering as desired 2. Click then 4. click 3. Review criteria 5. Name the query and click OK
27
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-27 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 How do you create a parameter query? Features Summary Open a query in Design view; type each prompt enclosed in square brackets [ ] into a Criteria cell or field
28
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-28 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 How do you join two tables so that all the records in the primary table will display? Features Summary Choose Left outer join In query design, double-click the join line
29
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-29 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 How do you join two tables to display only the records that match between the primary and secondary tables? Features Summary In query design, double-click the join line Choose Inner join
30
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-30 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 How do you create a new table from selected records in an existing table? Display the records with a Select query, then change the query to a Make Table query Features Summary
31
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-31 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 How do you add records from one table to the end of another table? Features Summary Display the records with a Select query, then change the query to an Append query
32
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-32 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left, and Right Joins Inner, Left, and Right Joins Self-Join Calculated Field Query with a Subquery Query with a Subquery Table Alias Multi-valued Field in a Query Multi-valued Field in a Query Action Queries Make-Table Query Delete Query Append Query Update Query Features Summary ACCESS 2007 Chapter 3 Coming Next CREATING AND USING CUSTOM FORMS Chapter 4
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.