Exploring Microsoft Access 2003

30
Exploring Microsoft Access 2003 Chapter 3 Information From the Database: Reports and Queries

description

Exploring Microsoft Access 2003. Chapter 3 Information From the Database: Reports and Queries. Objectives (1 of 2). Describe types of reports Describe views in Report window Describe similarities between forms and reports with respect to controls - PowerPoint PPT Presentation

Transcript of Exploring Microsoft Access 2003

Page 1: Exploring Microsoft Access 2003

Exploring MicrosoftAccess 2003

Chapter 3

Information From the Database: Reports and Queries

Page 2: Exploring Microsoft Access 2003

Objectives (1 of 2)

• Describe types of reports• Describe views in Report window• Describe similarities between forms

and reports with respect to controls• List sections in a report and explain

purpose• Differentiate between a query and

a table

Page 3: Exploring Microsoft Access 2003

Objectives (2 of 2)

• Use design grid to create and modify a query

• Explain multiple criteria rows and implement AND and OR conditions

• Define an action query• Create a crosstab query

Page 4: Exploring Microsoft Access 2003

Overview

• Information is data arranged in a useful format

• Convert data to information with queries and reports

• Understand concepts for reports and queries built on knowledge of tables and forms

Page 5: Exploring Microsoft Access 2003

Reports and Their Anatomy

• Columnar report vs. Tabular report• Report header & footer• Page header & footer• Group header & footer• Detail section• Report Wizard

Page 6: Exploring Microsoft Access 2003

Report View

Report Header

Page Header

Detail Section

Page 7: Exploring Microsoft Access 2003

Report Design View

Report Header

Page Header

Detail Section

Page footer

Page 8: Exploring Microsoft Access 2003

The Report Wizard

Hands-On Exercise 1

• Open Database

• Report Wizard

• Preview Report

• Modify Control

• Add Unbound Control

•Change Sort Order•View Report•Report Properties

Page 9: Exploring Microsoft Access 2003

Creating a Query

• Query

• Design grid

-Field, Table, Sort, Show, & Criteria

• Dynaset

Page 10: Exploring Microsoft Access 2003

Creating a Query

• Select query

• Query window views

- Datasheet view

- Design view

- SQL view

Page 11: Exploring Microsoft Access 2003

Creating a Query--Selection Criteria

• AND condition• OR condition• Relational operators• Between function• NOT function• Wild card

Page 12: Exploring Microsoft Access 2003

Creating a Select Query

Hands-On Exercise 2

• Open Database

• Add Students Table

• Create Query

• Specify Criteria

•Run the Query

•Modify Query

•Create a Report

•View the Report

Page 13: Exploring Microsoft Access 2003

Select Query Design View

table

criteria

Run button

Page 14: Exploring Microsoft Access 2003

Select Query Dynaset

The results of the queryare displayed as a dynaset

Page 15: Exploring Microsoft Access 2003

Grouping Records

• Use report anatomy to group records• Grouping allows calculations like:

- Count function- Sum function- Min function- Max function- Average function

Page 16: Exploring Microsoft Access 2003

Grouping Records

Hands-On Exercise 3

• Create the Query• Add a Calculated Control• Run, Modify, and Rerun the Query• The Report Wizard• Sorting and Grouping• Create the Group & Report Footers• View the Report

Page 17: Exploring Microsoft Access 2003

Crosstab & Action Queries

• Hands-On Exercise 4

• Create Make-Table Query• Create Delete Table Query• Create Append Table Query• Create Update Query• Check Progress• Create Crosstab Query

ActionQueries

Page 18: Exploring Microsoft Access 2003

Action Queries:

• Make-table query: Creates a table to hold information on graduating students.This information comes from the Students table.Graduating students are those students who have completed120 credits or more.

• Delete query:Removes graduating students from the Students table.

• Append query:Adds newly transferred students to the Students table. TheTransfers table holds information about new students.These students are added to the Students table using anAppend query.

Page 19: Exploring Microsoft Access 2003

•Update query: Sets the Financial Aid attribute to Yes for qualified Students who have a GPA of 3 or more are entitled to financial assistance.

Crosstab Queries:• Creates a crosstab query to generate a 'table' showing

Major by average GPA. This information is presentednicely by a crosstab query.

Page 20: Exploring Microsoft Access 2003

Join operation:

Select Fname, Lname, Dependent.NameFrom Employees, DependentsWhere Employees.SSN = Dependents.ESSN

Page 21: Exploring Microsoft Access 2003

Essn dependent_name ...

333445555 Alice

333445555 Theodore

333445555 Joy

987654321 Abner

123456789 Michael

123456789 Alice

123456789 Elizabeth

Relational algebra - Join

•Employees ssn=essn Dependents

fname minit … ssn

Franklin T … 333445555

Jennifer S … 987654321

John B … 123456789

Page 22: Exploring Microsoft Access 2003

fname minit ssn essn

Franklin T 333445555 333445555 Alice

Franklin T … 333445555 Theodore

Franklin T … 333445555 Joy

Jennifer S … 987654321 Abner

John B … 123456789 Michael

John B … 123456789 Alice

John B … 123456789 Elizabeth

Employees ssn=essn Dependents

...dependent_name

Page 23: Exploring Microsoft Access 2003

Outer Joins

•join - only matching tuples are in the result

•left outer join - all tuples of R are in the result regardless ...

•right outer join - all tuples of S are in the result regardless ...

•full outer join - all tuples of R and S are in the result regardless ...

R

R

R

R

S

S

S

S

Page 24: Exploring Microsoft Access 2003

Left Outer Joins

r1 r2B1=B2

a1 b1

a3 b3a2 b2

Cc1

c3null

a1 b1

a3 b3a2 b2

r1

b1 c1 C

b4 c4b3 c3

r2

Page 25: Exploring Microsoft Access 2003

r1 r2

a1 b1

a3 b3a2 b2

r1

b1 c1 C

b4 c4b3 c3

r2

a1 b1

null b4a3 b3

Cc1

c4c3

Right Outer Joins

B1=B2

Page 26: Exploring Microsoft Access 2003

Full Outer Joins

r1 r2

a1 b1

a2 b2

Cc1

a3 b3 c3null

B1=B2

null b4 c4

a1 b1

a3 b3a2 b2

r1

b1 c1 C

b4 c4b3 c3

r2

Page 27: Exploring Microsoft Access 2003

Chapter 3 Summary (1 of 2)

• Data refers to facts about a record• Information: data arranged in useful

format• Report prints and displays information

from a database• Reports created through Report Wizard• Reports: based on table or query

Page 28: Exploring Microsoft Access 2003

Chapter 3 Summary (2 of 2)

• Query selects information to display

• Grouping records in a field forsummaries

• Action queries modify records

• Crosstab queries display aggregated

• rather than individual records

Page 29: Exploring Microsoft Access 2003

Practice with Access

1. Our Students Database2. Employee Database3. The United States Database4. Bookstore Database5. Super Bowl Database6. Database Properties7. Action Queries8. The Switchboard Manager

Page 30: Exploring Microsoft Access 2003

Case Studies

• The United States of America

• The Super Bowl

• Mail Merge

• Compacting vs. Compressing