Access Session 4: Using Queries To Select Data
Access Session 4: Using Queries To Select Data
Access Session 4: Using Queries To Select Data
Database Operation in Table Datasheet view Retrieve, sort and group data Limit results Evaluate expressions
how to.
Records menu Table Datasheet toolbar
Filter by Selection Excel concept of AutoFilter Filter by Form Excel concept of Custom Filter
Logical Or And
Meets any one condition Meets all conditions Negates arguments
Not
Falls into two extremes and Between includes the Like String matches a pattern extremes
Query Preliminaries
Queries are used to sort, filter, add, delete, and modify data in MS Access databases use queries to request data for forms, reports, and controls when an object relies on specific data rather than on all the data in the underlying table.
Query Types
1/2
Select: retrieve data that meets specific conditions, group records for viewing summary data, and display calculations performed on data fields Action: modify existing data in some way, used to delete, update, and append data or to create a new table.
Query Types
2/2
Parameter: prompt you for criteria before running the actual query Crosstab: summarize data and then group the summarized values into categories SQL: include union, pass-through and datadefinition queries, require specific SQL commands, that you must compose in SQL view
query Design view: identify the tables and queries that you want to include in your query. and create & view queries
field list: upper part window displays a field list for each table or query design grid: lower part window, define the querys fields and accept expressions as criteria for limiting the results of the query
SQL view: translated query design view into Jet Structured Query Language.
AS: creates a clause that specifies an expression or value and the field name associated with it DISTINCTROW: exclude duplicate records from the query FROM: Create a clause specifying the table or query from which fields are taken for the query ORDER BY: Crates a clause containing a list of fields to be included in the query
SELECT: creates a clause containing a list of fields to be includes in the query UNION: Combines two sets of records into a single set WHERE: Creates a clause with a condition (or set of conditions) for filtering query records.
The Simple Query wizard Summarizing Data using the Wizard Retrieving Data using the Design view
1. 2.
click new, then add fields from the Show table window execute the query using the Run button from the Query Design toolbar
Crosstab
Crosstab query is a query that groups summarized data by categories, a more compact way to group and summaries record Crosstab vs PivotTable
both summarize data using aggregate functions PivotTables are more powerful because they can display the detailed data behind those subtotals and grand totals without affecting the groups
To sum it up