Presentation is loading. Please wait.

Presentation is loading. Please wait.


Similar presentations

Presentation on theme: "Chapter 6 UNDERSTANDING AND DESIGNING QUERIES AND REPORTS."— Presentation transcript:


2 Queries Query languages – Enable users to communicate with the DBMS in more structured formats Structured query language (SQL) Query by example (QBE)

3 Queries Query languages - Structured Query Language (SQL) Basic format of query SELECT attributes FROM tables WHERE criteria

4 Queries Query languages – Structured Query Language (SQL) Format allows: Specifying attributes to include in the output Accessing data from tables based on a condition Specifying tables from which attributes used in the criteria can be obtained

5 Queries Query languages – Query by Example (QBE): Simpler but less powerful approach for communicating with the database Specify the desired output from one or more tables using a grid Enter name of each desired attribute (field) into a different column in the grid Enter selection criteria in the appropriate attribute’s column User doesn’t have to learn details of SQL

6 Queries Query specification: Single table queries – Two sets of questions: 1. What attributes do users require in the query output? What tables contain the attributes required? 2. What criteria will be used to generate the output? What attributes will be used in the criteria? What tables contain the attributes needed?

7 Queries Query specification: Single table queries – Once queries are answered, either Use a QBE grid to specify the given information to the DBMS or Express the information in a SQL statement

8 Queries Query specification: Multiple table queries – Make sure the different tables in the query are properly linked to each other Answer question # 3 – What foreign keys link the information in a table to the primary keys of other tables in the query?

9 Queries Specifying criteria with multiple conditions: Template for expressing query design Complex queries and the navigation template

10 Types of Reports 4 reports based on the organization of the data - Simple list Grouped detail Summary Single entity Reports can be based on the type of data

11 Types of Reports Need to review the format (layout) of a report. Then, consider the following questions related to report design: What data are included in a report? How are the data organized?

12 Types of Reports Report layout: Most reports have: Report header Page header Page footer Report footer Report details section

13 Types of Reports Report layout: Two important elements of any report: Label boxes Display descriptive text Unaffected by table data Static - do not change when underlying data changes Text boxes Display data taken or derived from a table Depends on current contents of table Dynamic

14 Types of Reports Report layout: Grouped detail reports – Grouped by something (the grouping attribute) Contain: Group header Group detail Group footer

15 Types of Reports Report content Report organization

16 Event Reports List or summarize event data available in transaction tables Draw on data available in transaction tables for most of their content Criteria are used to restrict output to specific events

17 Event Reports Report should show criteria used to select information Report header should show starting and ending dates of the events Simple event lists: Simple listing of events during a time period organized by event date or transaction # No grouping or subtotals

18 Event Reports Grouped event detail reports: List of events during a period Commonly grouped by products/services or agents Subtotals are often reported Easier to analyze than ungrouped reports

19 Event Reports Event summary report: Summarizes event data by various parameters May be superior to grouped event detail reports when a large number of groups needs to be reported

20 Event Reports Single event report: Details about a single event Often printed for documentation or to give to customers or suppliers

21 Reference Lists and Status Reports Focus on providing information about products, services, or agents Criteria can be used to restrict the output

22 Reference Lists and Status Reports 4 report models focus on organizing and summarizing master table data Reference lists Grouped detail status reports Summary status reports Single product/service/agent status reports

23 Reference Lists and Status Reports Reference lists: Report only reference data that are taken from master tables Information about balances or quantity on hand not included in reports

24 Reference Lists and Status Reports Status reports: Summary data about products, services, agents Grouped detail status reports Display summary data, usually some reference data, and supporting details Draw on event and product/service/agent records Usually list one type of event

25 Reference Lists and Status Reports Status reports: Summary status reports List reference and summary data about products/services/agents Summarize the status of the product, service, agent Single product/service/agent status reports Provide detailed data Include both reference and summary data for a single entity

26 Appendix: Using navigation templates to design queries: For more complicated queries To document the reasoning behind the query design Navigation template: A problem-solving aid Helps document how to assemble information from various tables in response to a query

27 Appendix Navigation template: Two basic ways to identify information from tables 1. Identify records that satisfy a certain condition – criterion is based on attributes of a single table 2. Identify records where a value in the attribute of one table matches the value of an attribute in another table - criterion requires information from multiple tables

28 Appendix Navigation template: Helps avoid errors in query construction Forces careful thinking about required tables Omitting required tables or adding unnecessary tables may result in incorrect answers When template is completed Construct actual query Query design template can summarize design of query

29 K E Y T E R M S Database management system (DBMS) FROM Event summary report Group footer Group header Grouped detail report Grouped detail status reports

30 K E Y T E R M S Grouped event detail reports Label boxes Page footer Page header Query Query by example (QBE) Reference lists

31 K E Y T E R M S Report Report details Report footer Report header SELECT Simple event lists Simple list Single entity report Single event report

32 K E Y T E R M S Single product/service/agent status reports Status reports Structured query language (SQL) Summary report Summary status reports Text boxes WHERE


Similar presentations

Ads by Google