G061 - Queries “The search begins …..”
Learning Objectives: By the end of this topic you should be able to: describe different types of queries and explain when they might be used; use Access to create a range of queries to meet specific requirements
What are Queries? used to search for data used to combine data from different tables to create a “virtual table” of data used to base a form or report on used to perform calculations on data fields
Types of Query There are 2 main types of search query: simple query search using only 1 parameter complex query search using more than one parameter
Simple Query uses a single value (parameter) to search by e.g. searching for a specific book title
Simple Query uses a single value (parameter) to search by e.g. searching for a specific book title can be a static parameter query parameter is ‘hard-coded’ and can’t be changed
Simple Query uses a single value (parameter) to search by e.g. searching for a specific book title can be a static parameter query parameter is ‘hard-coded’ and can’t be changed e.g. Village = Brixworth
Simple Query uses a single value (parameter) to search by e.g. searching for a specific book title can be a static parameter query parameter is ‘hard-coded’ and can’t be changed e.g. Village = Brixworth
Simple Query uses a single value (parameter) to search by e.g. searching for a specific customer by name can be a dynamic parameter query parameter is supplied at run time
Simple Query uses a single value (parameter) to search by e.g. searching for a specific customer by name can be a dynamic parameter query parameter is supplied at run time dialogue box prompts for the search parameters
Complex Query uses several criteria (parameters) to select records the criteria are linked by Boolean operations: AND, OR, NOT AND is used for records matching both criteria: Colour = Red AND Model = Corsa OR is used for records matching one of the criteria: Colour = Blue OR Colour = Red NOT in front of criterion finds records that don’t match: NOT Colour = Pink
Gender = F AND Village = Brixworth Complex Query Gender = F AND Village = Brixworth
Gender = F AND Village = Brixworth Complex Query Gender = F AND Village = Brixworth
Village = Brixworth OR Village = Moulton Complex Query Village = Brixworth OR Village = Moulton
Village = Brixworth OR Village = Moulton Complex Query Village = Brixworth OR Village = Moulton
Query Tasks: download a copy of query demo.mdb from the VLE right-click & Save target as …. using query demo.mdb create the following: a simple, static parameter query to display a list of all Economics (ECON) books; a simple, dynamic parameter query which allows you to choose the type of book and displays a list of the books of that subject; a complex, static parameter query to display a list of all Chemistry books written by Ramsden; a dynamic complex parameter query which allows you to choose a subject and an author to a display list of books add the query types definitions to your glossary