120 likes | 246 Vues
In this lesson, you will learn to create complex queries in Access that involve multiple tables. You'll understand how to utilize select queries, crosstab queries, and parameter queries, enabling efficient data retrieval and analysis. We’ll cover the creation of calculated fields and action queries like delete, update, and append. Additionally, you'll discover how to analyze and document databases, perform data backups, and optimize database performance through compacting and repairing. By the end, you'll be equipped with the skills to effectively manage and analyze data across tables.
E N D
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
Access Query Types • Select Query • Crosstab Query • Unmatched Query • Duplicates Query • Parameter Query • Action Query • SQL Query
Working with Relationships • 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
Parameter Queries • Prompt users for input to narrow the query output • Criteria expression contains prompt text Criteria expression prompts user for a value when the query is run Criteria expression appears in the query grid Criteria row Tip! Brackets always surround the criteria expression.
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]
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
Setting Up an Action Query • Each action query has a source and destination table • Action types are set using Query Type controls on the Ribbon Action query types Source table is the active table; destination table identified in the dialog box
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
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
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