7. Creating a Query Identify where the data is coming from Determine which rows are part of your answer Identify any groups or summaries needed Specify which groups are part of the answer Select the fields or calculations to include in the result Apply sorting to help users understand result
8. Query Data Sources Queries can use tables or queries as data sources If more than one table is needed for the query result a join is required Make sure that there is a connection (join) to each table Make sure you can find common values to connect each table
9. Joins Connect tables temporarily when query executes Access will create a join automatically where tables have a relationship Join fields should be on fields that are the same data type
10. Types of Joins Inner Join Default join Looking for matching values in both tables If a table has a value not found in the second table nothing is returned Outer Join Allows query to return rows that don’t have a match in the other table Cartesian Join Combines all rows whether match or not
11. Query Criteria Which rows should be included? Criteria are True/False conditions/comparisons Conditions can use: Relational operators (=, >, <, <=, >=, <>) Between Like (patterns, Wild cards)
12. Wild Cards Wild cards can help describe patters ? – one character in a particular space * - zero, one, or morecharacters S?ND returns SAND, SEND S*ND returns SAND, SENT, STAND, SOUND
13. Logical Operators Needed when there are multiple criteria AND condition: all tests must be passed OR condition: as long as one test is passed the row is included NOT creates the inverse If something returns True, NOT makes it False
14. Grouping Grouping (“totals queries” in Access) provides summaries about data Can create summary values using Aggregate functions How many? (Count) How much? (Sum) Can summarize all rows or find common values to create groups Total Credits v. Total Credits for each department
15. Sorting Query results can be sorted Access works from left to right when sorting if multiple fields are sorted