Chapter 3
Information From the Database: Reports and Queries
• 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
• 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
• 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
• Columnar report vs. Tabular report
• Report header & footer
• Page header & footer
• Group header & footer
• Detail section
• Report Wizard
Report Header
Page Header
Detail Section
Report Header
Page Header
Detail Section
Page footer
Hands-On Exercise 1
• Open Database
• Report Wizard
• Preview Report
• Modify Control
• Add Unbound Control
•Change Sort Order
•View Report
•Report Properties
• Query
• Design grid
-Field, Table, Sort, Show, & Criteria
• Dynaset
• Select query
• Query window views
- Datasheet view
- Design view
- SQL view
• AND condition
• OR condition
• Relational operators
• Between function
• NOT function
• Wild card
Hands-On Exercise 2
• Open Database
• Add Students Table
• Create Query
• Specify Criteria
•Run the Query
•Modify Query
•Create a Report
•View the Report
table criteria
Run button
The results of the query are displayed as a dynaset
• Use report anatomy to group records
• Grouping allows calculations like:
- Count function
- Sum function
- Min function
- Max function
- Average function
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
• Hands-On Exercise 4
• Create Make-Table Query
• Create Delete Table Query
• Create Append Table Query
• Create Update Query
• Check Progress
• Create Crosstab Query
Action
Queries
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 completed
120 credits or more.
• Delete query:
Removes graduating students from the Students table.
• Append query:
Adds newly transferred students to the Students table. The
Transfers table holds information about new students.
These students are added to the Students table using an
Append query.
•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 presented nicely by a crosstab query.
Join operation:
Select Fname, Lname, Dependent.Name
From Employees, Dependents
Where Employees.SSN = Dependents.ESSN
Relational algebra - Join
•Employees ssn=essn
Dependents fname minit … ssn
Franklin T … 333445555
Jennifer S
John B
… 987654321
… 123456789
Essn dependent_name ...
333445555 Alice
333445555 Theodore
333445555 Joy
987654321 Abner
123456789 Michael
123456789 Alice
123456789 Elizabeth
Employees ssn=essn
Dependents fname minit ssn essn dependent_name ...
Franklin T 333445555 333445555 Alice
Franklin T
Franklin T
…
…
333445555 Theodore
333445555 Joy
Jennifer S
John B
John B
John B
…
…
…
…
987654321 Abner
123456789 Michael
123456789 Alice
123456789 Elizabeth
Outer Joins
R
R
S
•join - only matching tuples are in the result
S
•left outer join - all tuples of R are in the result regardless ...
R
R
S
•right outer join - all tuples of S are in the result regardless ...
S
•full outer join - all tuples of R and S are in the result regardless ...
Left Outer Joins r1
A a1 a2 a3 r1
B1=B2 r2
B1 b1 b2 b3
A a1 a2 a3
B1 b1 b2 b3
C c1 null c3 r2
B2
C b1 c1 b3 c3 b4 c4
Right Outer Joins r1
A a1 a2 a3
B1 b1 b2 b3 r1
B1=B2 r2
A a1 a3
B1 b1 b3 null b4
C c1 c3 c4 r2
B2
C b1 c1 b3 c3 b4 c4
Full Outer Joins r1
A a1 a2 a3 r1
B1=B2 r2
B1 b1 b2 b3
A a1 a2 a3
B1 b1 b2 b3
C c1 null c3 null b4 c4 r2
B2
C b1 c1 b3 c3 b4 c4
(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
(2 of 2)
• Query selects information to display
• Grouping records in a field for summaries
• Action queries modify records
• Crosstab queries display aggregated
• rather than individual records
1. Our Students Database
2. Employee Database
3. The United States Database
4. Bookstore Database
5. Super Bowl Database
6. Database Properties
7. Action Queries
8. The Switchboard Manager
• The United States of America
• The Super Bowl
• Mail Merge
• Compacting vs. Compressing