1 / 10

Summary Queries

Summary Queries. Query Wizard This is a choice once you select fields Much easier to develop some summary queries with the wizard, then learn how to do it in design view Wizard is pretty “smart”, it knows about dates, etc. Examples: mean length of fish, count of fish by species.

mpauly
Download Presentation

Summary Queries

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Summary Queries • Query Wizard • This is a choice once you select fields • Much easier to develop some summary queries with the wizard, then learn how to do it in design view • Wizard is pretty “smart”, it knows about dates, etc. • Examples: mean length of fish, count of fish by species

  2. Summary Queries • Queries can operate using the results of other queries • This is critical because many operations you may want to perform can not be done in a single query (i.e., it takes more than one step to get what you want) • Example: proportions of species by sample date • First, use summary query to get counts by each species • Second, use summary query to get total catch for each date • Third, merge total catch back with counts, and calculate proportions

  3. Crosstab queries • Crosstab queries are extremely powerful tools to create tables • Basic idea is that values of some field can become new field names (e.g., individual fish species caught become columns) • As with summary queries, easiest to start with Wizard. To create new crosstab query, start in queries, then select new from menu bar within database window • Best seen through example: catch table

  4. Crosstab queries • As far as I know, crosstab queries can only operate on a single table or other query, so you may need to first use a select query to get the data together that you want in the query • I haven’t used pivot tables, but they can apparently create similar output as a crosstab query

  5. Crosstab queries • http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q132/1/40.asp&NoWebContent=1 • Web site for exchanging nulls to zeros in crosstab query

  6. Action Queries • Action queries modify the data in a table, so you want to be VERY careful using these • Update query: replaces existing data • Append query: adds new records to a table • Delete query: removes records from a table • Make-table query: creates a new table • We won’t cover these in depth. They are useful, but I’ve never really had to use them

  7. Querying DatabasesPart Deux • Examples of using multiple queries to accomplish particular analysis tasks • First example – determining percent of total catch by species

  8. Percent of Total Catch • First need to recognize current database structure • Fish catch lists individual fish, so first need to compute total catch for each species • After get total catch for each species, want to get total catch • Percent of total catch is gotten by dividing species-specific catch by total catch, so need to merge or join this information somehow

  9. Percent of Total Catch • Fish catch lists individual fish, so first need to compute total catch for each species • Do summary query on fish data table

  10. Percent of Total Catch • So far – we computed totals and percentages for all records. A refinement would be to compute this for individual sampling dates. • We do this by grouping (by groups) in the summary tables

More Related