Introduction to Database Concepts
A Database is a collection of interrelated data stored together without harmful or unnecessary
redundancy, organized to the needs and structure of the organization and serve multiple applications.
A typical database management system (DBMS) consists of the following components.
Backup & Recovery
Privacy
Subsystem
Interface
Forms
Queries
Reports
Integrity
Subsystem
Logical –
Physical Map
Physical
Storage
Structure
The data is physically stored in the Physical Storage Structure. For most corporate information
systems, the database is stored on the network data server.
To protect the data in the database, the database must be backed up periodically. The backup
medium (usually tapes) must be stored in a safe location to protect the data from theft, fire, heat, or
water damage. If the physical data on the data server has been damaged or destroyed, the database
must be recovered from the backup tapes. Procedures must be in place to define how and when
backups are done, the proper storage of the backup medium, and how to recover the database when a
disaster occurs.
The Logical-Physical Map converts the logical database structure into the actual physical location of
the data on the hard drive.
The Interface consists of the queries, forms and reports that the user uses to enter/edit data and
retrieve information from the database.
The privacy subsystem involves protecting the database from authorized access. There are three
aspects of security that are involved with the database privacy subsystem. The identity of the user is
stored either in the privacy subsystem or in the network security system. Authentication involves
making sure the user is who he/she says he/she is. In most systems a password is used for checking
authentication. A person’s finger print, retinal scan, and security cards are other forms of checking
authentication. Authorization involves the user’s rights and privileges to the database, forms, and
reports. Rights refers to whether the user has the right to access the database or specific table in the
database. Privileges refers to the level of access (no access, read only, full access, etc.)
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 1
The integrity subsystem involves checking the “goodness” of data being entered into the system.
In Microsoft Access, integrity or validation rules define what can and cannot be stored in the field.
An entity is an item or object (person, place or thing).
An attribute is a property or descriptor of an entity.
Customer
Customer ID
Last Name
First name
Street Address
Car
Car ID
Model
Year
Color
A table is used to store data for all similar entities (all customers or all cars). A record is a row
from the table and is used to store all of the data for one specific entity. A field is one cell in the
table and is used to store the attribute data. The field name is the field property that describes the
content of the field. The field name is found at the top of each column of the table.
Field
name
field
Record
A primary key attribute uniquely identifies the entity. In the above two examples, the customer id
uniquely identifies the customer and the course number uniquely identifies the course. The primary
key cannot be empty or contain duplicate data. No two customers can have the same identical
customer id.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 2
A Relational Database is represented as a series of relations or flat tables (similar to an Excel
worksheet). To form a unified relational database, the tables must be joined together using a foreign
key attribute. A foreign key is a subset of a primary key in a different table. The foreign key
typically has the same field name as the primary key in the related table. In the example below, the
Customer ID field in the Car table is a foreign key. The associated primary key is the Customer ID in
the Customer table. The Customer ID field joins each record in the Car table with a single record in
the Customer table. Notice that the foreign key does not have to be unique; each customer can
own (be associated with) several cars (records) in the Car table. In the following example, Mickey
Carr purchased two cars (1999 Cobra and a 2003 Cobra XT) from this dealership.
Foreign key
Primary Key
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 3
Questions:
1.
How is a database different from a collection of data?
2.
What is the basic structure of a relational database?
3.
What is a primary key? What are the two most important characteristics of a primary key?
4.
What is the purpose of a foreign key? Typically, what field name given to the foreign key?
5.
Why are fields that can be calculated from other fields not physically stored in the database?
6.
List 4 of Kahn’s reasons for good database design.
7.
Whether your computer system is a thousand-node network or a single computer, you can save
your company time and money if you learn to maintain the documentation you get and create
the documentation you need. List several of Patten’s suggestions for documentation.
8.
What is a data warehouse (based on the Information Systems articles)? How does a data
warehouse differ from a standard database? (List at least 6 differences)
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 4
Data Dictionary
Open the SCORPION database. Switch to the tables. There are 5 tables.
Look at the design of the car table. Microsoft Access uses the following field descriptors to define
each field.
The field name is the name that describes the contents of the field. In the table design view
The
symbol in front of the first field in the table indicates that the Car ID is the primary
key field. The primary key field is typically listed first in each table.
The field data type identifies the type of data that can be stored in the field. The field data
type is defined in the table design view. Microsoft Access has the following data types:
o Text. Anything type of data can be stored in a Text field. The field size defines the
maximum number of characters that can be stored. Most fields are text fields.
o Number. The entry must be a number.
The number of decimal places can be
defined.
o Data/Time. The entry must be a date or
time of day. Different date and time formats
are available.
o Currency. The number of decimal places
can be defined.
o Auto Number. The field contains an
automatically generated sequential whole
number.
o Yes/No. The entry is a check box that indicates YES/NO or True/False.
o OLE. Pictures can be stored in an OLE data field.
o Hyperlink. The data must be a hyperlink.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 5
The field format and input mask are used to describe how the data is to be displayed or
entered. Should the date be formatted as 02/12/2000, 12 Feb 2000, or Feb 12, 2000?
Default value. The initial value when creating a new record. Special symbols are placed around
actual dates (#01/01/2000#) and text phrases (“Lake Wales”). No special symbol is placed
around a numerical value or Yes/No logical states. For a car dealership in Lake Wales, most new
customers would live in Lake Wales. Assigning the initial value of the city, state, and zip code to
Lake Wales FL 33853 would save time when creating most new records. Functions can be used
in defining the default value, such as using the date() function to enter today’s date.
Validation Rules and Text. The validation rule defines a rule in which all entered data must
pass. The validation rule does NOT ensure that the data is correct, but that the data is reasonable
or within predefined parameters. The following symbols define numerical relationships:
= equal to
< less than
> greater than
<> not equal to
<= less than or equal to
>= greater than or equal to
The logical operators, AND and OR, can also be used to show more complex relationships. For
the purchase price of a car, the validation rule, >=10000 AND <= 60000, would restrict the
purchase price to a value between $10,000 and $60,000. Special symbols are placed around actual
dates (>=#10/12/1999#) and text phrases (“Cobra” or “Cobra XT” or “Viper” or
“Stinger” or “Stinger LX”). If the validation rule fails, the validation text is displayed
explaining why the entry was rejected.
Field Required and Field Zero Length. For some fields, the content cannot be empty. These
parameters can be used to force the user to enter a value before the record is stored in the table.
Remember, key fields cannot be empty.
Index. Indexing is used in the database system for automatic sorting and fast record retrieval.
When setting an index, define whether duplications are permitted. Remember, key fields cannot
have duplications.
The Model can have a
maximum of 10 characters.
The Model of the car has a
default value of “Stinger”
because most new cars
purchased are Stingers.
The Model must be either
Cobra, Cobra XT, Stinger,
Stinger LX, or Viper.
The Model is a required field.
Each car purchase must have a
model.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 6
•
Lookup definition. This is used on foreign keys to lookup a value from the related primary
key. Remember, a foreign key must be a subset of a primary key in a different table.
The Customer ID in the Car
table is a foreign key that
joins the Car table to the
Customer table.
The lookup feature allows the
user to select the Customer ID
in the Car table from field 1
(Customer ID) in the
Customer table. Display 3
columns (Customer ID, Last
Name, and First Name).
Close the define view window. Click on
foreign/primary keys in the related tables.
from the toolbar to display the relationships between the
Each table is tied to another table through these 1-to-many (1-to-∞) relationships. The “1” side
indicates a primary key. The ∞ side indicates the foreign key. Defining these relationships is
important. First, a value cannot be entered into a foreign key field unless it is found in the associated
primary key. Second, a primary key value cannot be changed (or the record deleted) if the value is
being used in the associated foreign key. Third, multi-table queries are easier to build.
A relational database is easier to process if all of these table relationships are 1-to-many. Avoid manyto-many relationships between tables. If a 1-to-1 relationship exists between two tables that have the
same primary key, determine whether the two tables need to be combined into a single table.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 7
Forms are used to enter data. Forms are designed similar to the corresponding paper form.
First Record
Previous record
Active Record Number
Next Record
Last Record
Add New Record
Questions:
In Microsoft Access, what field properties can be defined?
What field type should be used for each of the following?
__________ phone number
__________ social security number
__________ zip code
__________ age
__________ birth date
__________ Clean (Was the car cleaned? Yes or no)
__________ balance
__________ odometer
__________ quantity
Why is it important for the table relationships to be defined?
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 8
Queries
A Query is a program that obtains information from the database. A query may involve
• Specifying which fields from a table to display. Display only the last name, first name, and phone.
• Criteria for selecting which records from a table to display. Select all customers (records) who live
in Lake Wales, FL.
• Sorting the data by one or more fields. Sort by the customer’s last name and then by the first name.
• Calculation fields. Calculate the sales tax on the purchase of a car.
• Joining records from two related tables. If the table relationships are not defined, then the table
with the foreign key must be opened before the table with the primary key.
The most efficient method of creating a new query is in the design view. Switch to the Queries.
Double click on Create Query in Design View.
Select the customer table. Click on ADD. Click on CLOSE.
Enter the fields that are included in this query.
*** continue on the next page ***
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 9
Select only those customers (records) who live in Lake Wales, FL. In the criteria section, special
symbols are placed around text phrases and dates: “text” and #date#. Numbers do not use a special
symbol. The following operators are used:
=
equal to (assumed if no operator is listed)
=”Lake Wales”
or “Lake Wales”
<> not equal to
<>”Lake Wales”
<
less than
<1000
<= less than or equal to
<=#12/31/00# (on or before)
>
greater than
>#01/01/99# (after)
>= greater than or equal to
>=500
Also, the two logical operators, AND and OR can be used to expand or restrict the criteria. With
AND all conditions must be true . With OR only one condition needs to be true. If the criteria
involves the AND relationship with two or more fields, the conditions are placed in the appropriate
cells on the same row. By placing criteria on different rows, the conditions are joined using the OR
operator. In situations where a complex relationship exists with a single field, the AND/OR operator
must separate the two conditions; for example, >20000 AND <50000
Sort by the customer’s last name, first name, and middle initial.
Click on the X in the upper right corner of the window,
Microsoft Access will ask if you want to save the query. Indicate yes.
Because the query has not been named, the system will ask for a query name. Enter:
*** continue on the next page ***
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 10
To run the query, double click on the name of the query, or select the query and click on Open.
The output should look like the following.
Close the query, by clicking on the X in the upper right corner of the window,
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 11
Return to the design of Customer from Lake Wales Query. Microsoft Access creates a SQL
(Standard Query Language) program from the query definition, click on the following to switch to the
SQL view. Remember, you were in the Design View.
The SQL program created from this query definition is
SELECT Customer.[Last Name], Customer.[First Name],
Customer.MI, Customer.Street, Customer.City,
Customer.State, Customer.Zip
FROM Customer
WHERE (((Customer.City)="Lake Wales") AND
(Customer.State)="FL"))
ORDER BY Customer.[Last Name], Customer.[First Name],
Customer.MI;
The SELECT command identifies which fields are to be included in the query. The first field is
Customer.[Last Name]. Customer is the name of the table. Last Name is the name of the
field. [ ] are needed around the field name, because the field name contains a space. Microsoft Access
tends to place [ ] around all field names; whether the [ ] are needed or not. The decimal separates the
table name and the field name.
The FROM command indicates which tables are to be opened and in which order. When opening tables
that do not have the relationships predefined, the order of the tables is important in identifying the
primary key / foreign key relationships between the tables.
The WHERE command identifies the selection criteria. Notice the two statements are connected with
the AND operator. The logical operator, AND, requires all conditions to be true. The logical operator,
OR, requires only one of the conditions to be true. In the Design View mode, if two conditions are on
the same criteria row, they are connected with the AND operator. If the two conditions are on different
criteria rows, they are connected with the OR operator.
The ORDER BY command identifies how the selected records are to be sorted.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 12
Customer from a Desired City Query.
Copy the query and paste as a new query. Give the new query the following name.
• Select the Customer From Lake Wales Query (one click only – do not open or edit)
•
Click on
•
Enter the new query name.
Select the Customer from a desired city query and click on DESIGN.
Change the criteria to the following. [Desired City?] and [Desired State?] are the names of two
temporary fields (the data is not permanently stored). The [ ] are needed to identify each as the name
of a new (temporary) field. Also, they are needed because the field names contain a space. Save the
query.
When opening or running the query, the system will ask for a value for each of these temporary fields.
Enter Babson Park, FL as the desired city and state.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 13
Close the query.
Following the same procedures for making a copy of a query (top of page 15), use the Customer
from a Desired City Query and create the Customers on a Desired Street Query. Modify
this new query. Delete the previous criteria. Select only those records where the street address
contains the name of the desired street. None of the customer’s street address is equal to “Ludlow,”
but several of the customer’s street address contain the phrase, “Ludlow.” The LIKE operator with the
text wildcard, *, is used to find text phrases that are buried inside a longer text passage. The following
are examples of the LIKE operator:
Field
Criteria
Result
Last Name
Like “A*”
All customers with a last name that begins in “A”.
Last Name
Like “*a*”
All customers with a last name that contain the letter “a”
Last Name
Like “*ge”
All customers with a last name that ends in “ge”.
When an input field is used, the wildcard characters must be added to the input phrase using the
operator, &. The & operator assumes that all items being combined are text. 20&” dogs” results
in “20 dogs”. If Last Name field contains “Sorge” and the First Name field contains “Robert”, then
[First Name]&” “&[Last Name] results in “Robert Sorge”.
Open the query several times; each time use a different “desired street.” Enter values that will result in
several customers, one customer, and no customers displayed in the query.
Create a new query, named Cars with Price Over 22000 Query. Use the Car table. Display the
model, year, color, VIN, and price. Sort by the year first (most recent on the top) and the model
second (alphabetical). Select only those records with a price greater than or equal to 22000. Run or
open the query to verify that all displayed vehicles have a price greater than or equal to $22,000.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 14
Copy the Cars with Price Over 22000 Query and paste as Cars within Price Range Query.
Edit the query. Change the criteria. Select only those records with a price that is greater than or equal
to [What is the lower price range limit?] AND less than or equal to [What is the upper price range
limit?]. The price must be between these two values. Because both criteria involve the same field, the
AND operator is placed between the two criteria in the same cell.
Create a new query, named Cars Sold After Jan 1, 2007 Query. Use the Car table. Display the
model, year, color, VIN, price, and purchase date. Sort by the purchase date. Select only those records
with a purchase date that is on or after Jan 1, 2007. The criteria is >= #01/01/2007#. (# # symbols are
placed around dates. The default format for dates is mm/dd/yyyy.) Dates are numerical. “Greater
than” implies after the specified date. “Less than” implies before the specified date.
Copy the Cars Sold After Jan 1, 2007 Query and paste as Cars Sold After Desired Date
Query. Edit the query. Change the criteria. Select only those records with a purchase date that is on
or after [What is the earliest desired date?]
Create a new query, named Car Ownership Query. Use the Car and Customer tables. Display
the full name from the Customer table and the model, year, color, purchase date, and purchase price
from the Car table. Sort by the last name and first name. Select all records (no criteria).
Copy the Car Ownership Query and paste as Car Ownership by Model Query. Sort by the car
model, last name and first name. . (Hint: Microsoft Access sorts by the sort fields from left to right on
the design screen. From left to right the fields must be model, last name, and first name.)
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 15
Copy the Car Ownership Query and paste as Car Ownership for a Specified Model Query.
Sort by the last name and first name. Select all records where the model equals the [What is the
Desired model?].
Copy the Car Ownership Query and paste as Car Ownership for a Specified Model Year
Query. Sort by the last name and first name. Select only those records where the year is equal to
[What is the desired model year?].
All Service for Date Range Query. Use the Customer, Car, Service, and ServDesc tables.
Display the full name and mailing address from the Customer table, the model, year, and color from
the Car table, the service date, service charge, and mileage from the Service table, and the service
description from the ServDesc table. Sort by the service date and then by the customer’s name.
Select only those records where the service date is between the [First Date?] AND the [Last Date?].
[Hint: Logically, how would “between” be expressed mathematically? Look at the Cars Within
Price Range Query.]
Customer Service History Query. Use the Customer, Car, Service, and ServDesc tables.
Display the customer ID and full name from the customer table, the model and year from the car
table, the service date and service charge from the Service table, and the service description from the
ServDesc table. Sort by the service date (most recent at the top). Select only those records where
the customer ID is equal to the [Desired Customer ID?] field. Run the query using 00000 as the
desired customer id.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 16
Last Oil Change Query. Use the Customer, Car, Service, and ServDesc tables. Display the
full name and mailing address from the Customer table, the model and year from the Car table, the
service date and mileage from the Service table, and the service description from the ServDesc
table. Sort by the date (most recent on the top) and then by the customer’s name. Select only those
records where the service code equals “oil”.
Click on the Totals button.
Total on the Maximum of the service date.
Total on the Maximum of the Mileage.
Select and right-click on the Max of the Service Date Column. Select Properties. Define the format of
the date field to be mmm dd, yyyy.
The query should look similar to the following:
Close the query.
Copy Last Oil Change Query and paste as Notice of Next Oil Change Query. Edit the
criteria. Select only those records where the service code equals “oil”, and the Max of service date is
between 60 and 180 (2 months and 6 months) days ago, <date()-60 AND >date()-180. The
date() function has no arguments and returns the system date from the computer’s system.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 17
Count of Car Model for Desired Model Year Query. Use the Car table. Display the car model
(and the count). Turn on the Totals. Total on the count of the car model. Sort alphabetically by the
car model. Select only those records where the car model year equals the desired model year. (Hint:
The year field must be included in the query, but do not display the field.)
The output will look similar to the following:
Edit the Car Ownership Query. Add the following three calculation fields. The sales tax is 6% of
the purchase price. The dealer prep is $129. The total is the sum of the purchase price, sales tax, and
dealer prep. The formulas are:
• Sales Tax:0.06*[Purchase Price]
• Dealer Prep:129
• Total:[Purchase Price]+[Sales Tax]+[Dealer Prep]
Right click on the sales tax field. Select properties from the pop-up menu.
Select currency as the field format.
Repeat the process for the dealer prep and the total fields.
Run the query. Close the query.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 18
Create a new query, named Last 6 months Service Query. Use the Customer, Car, Service,
and ServDesc tables. Display the last name and first name from the Customer table, the service
date and service charge from the Service table, and the service description from the ServDesc table.
Calculate the Service Year of the service date, the Service Month Number of the service date, and the
Service Month Name of the service date. Place these calculated fields in the first five columns.
Service Year:year([service date])
Service Month Number:month([service date])
Service Month Name:monthname([Service Month Number])
Customer Name:[last name]”, “[first name]
Vehicle:[year]&” “&[model]
The year(date value) function returns the year from a date; the month(date value) function returns
the month number (1-12) from a date, and the monthname(month number) function returns the name
of the month from the month number. Calculate the Vehicle (place after the first name field column).
Click on the “build function” toolbar button,
, to study other Microsoft Access functions.
Select all records where the Service Date is within the past 180 days or >=date()-180. The date()
function has no arguments and returns the system date from the computer’s system. [Most Access
functions have the same name as in Excel. This is an exception. In Excel, the TODAY() function
returns the system date.] Sort by the Service Year (earliest first), the Service Month Number (earliest
first) and then by the customer’s Last Name.
Create a new query, named Customer Service History Query. Use the Customer, Car,
Service, and ServDesc tables. Display the last name and first name from the Customer table, the
model and year from the Car table, the Service Date and service charge from the Service table, and
Service Description from the ServDesc table. Select only those records where the customer id (from
the Customer table) equals {Desired Customer ID?]
.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 19
Questions:
What is a query? What type of question can and cannot be answered with a query?
What is data mining (based on the Information Systems articles)? What type of question can be
answered with data mining?
In the design mode, describe each row of the design table.
•
•
•
•
•
•
Field Section
Table Section
Total Section
Sort Section
Show Section
Criteria Section
Define the criteria in the first query.
How are the records being sorted in each query?
Define the purpose of the total section in the second query.
Identify the symbol for each of the following relationships.
____ equal to
____ less than
____ not equal to
____ less than or equal to
_____ greater than
_____ greater than or equal to
Define the two logical operators AND and OR. What is implied when two different criteria are placed
on the same row? What is implied when two different criteria are placed on different rows?
No symbol is placed around a numerical value. What symbol is typically placed around text? ______
What symbol is typically placed around a date? ______
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 20
REPORTS, LABELS, and MAIL MERGING
Creating Reports and Labels
Use the Report Wizard to create each of the following. It is easier to allow Microsoft Access to create
the basic report structure and then edit the structure to the desired requirements. Double click on
Create report by using wizard.
For the first report, the data will come from the query, Last Oil Change Query. Select the last
name, first name, car, and MaxOfServiceDate from the list of available fields.
The next step involves grouping. This report has no groupings. Go to the next step.
*** continue on the next page ***
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 21
Select no views or grouping.
Go to the next step.
An example showing
grouping by the
Customer & the Car
Sort the report by the customer’s last name and first name. Go to the next step
Select a tabular layout (portrait). In the tabular layout each record is printed on a separate line. In the
columnar layout each record is printed on a single page. A different set of layouts is displayed if the
fields are grouped.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 22
Select the Formal design structure.
On the last step, name the report, Last Oil Change Report.
The report should look similar to the following. There are several problems with this layout:
• Title is not complete
• Title is not centered above the table
• The table is not centered on the page
• The gaps between some of the columns is too wide
• Inappropriate column header text
*** continue on the next page ***
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 23
Edit the report structure to look like the following.
Left Alignment in these fields.
Right-click on the MaxOfServiceDate data field and select properties.
Set the format to mmm dd, yyyy (similar to formatting a date in Excel).
Repeat with the Mileage data field. Set the format to #,000
The report should look similar to the following:
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 24
Edit the Last Oil Change Report. Delete the last name, first name, Model, and Year fields. Click
on
(Text Box) button to create a new field. Position the fields as shown. The associated label box
can be deleted from the Detail section.
Right-click on this new text box and select properties. Set the Name to Customer and the Control
Source to =[last name]&”, “&[first name]. This field could have been calculated in the query.
Repeat the process to create a new text box.
Right-click on this new text box and select properties. Set the Name to Vehicle and the Control
Source to =[model]&” “&[year]. This field could have been calculated in the query.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 25
Car Ownership Report. Use the Car Ownership Query. Display the last name, first name,
model, year, purchase date, and purchase price. View by the Customer. Do not add any grouping.
Sort by the model. The view will automatically sort by the customer’s last and first names.
Use a step layout and a formal style. The stepped layout is only available when a view or grouping is
used.
Edit the report structure. Left align the purchase date data field, and right align the “price “.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 26
Car Ownership By Model Report. Use the Car Ownership By Model Query. Display all
fields. View by the model. Sort by the last name and first name. Use a step layout and a formal style.
Edit the report structure.
Count of Car Model for Desired Model Year Report. Use the Count of Car Model for
Desired Model Year Query. Display all fields. No grouping. No sorting. Use tabular layout and
the formal style. Edit using the following layout. The Year field is moved to the report header section.
The Year data field,
which is moved from
the Detail section
Display the report using different years.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 27
Customer Service History Report. Use the Customer Service History Query. Select all
fields. View by the Car.
Use a tabular structure and the Formal style. Edit the structure as shown.
• Move the last name and first name data field boxes to the report header section. Change labels as
shown.
•
•
•
•
Add two label boxes,
to the Report Header section for the phrases “Customer Service History
Report” and the phrase “Customer: “
Format the Service Date data and label fields to align the text on the left.
Center the report between the left-right margins.
. Go into the text box’s properties (rightExpand the report footer section and add a text box
click and select Properties). In the data field box, enter the equation, =sum([service charge]).
The sum() function is one of many functions built into Access that is used to write a formula.
The report structure should look similar to the following.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 28
Last 6 Months Service Report. Use the Last 6 Months Service Query. Select all fields. No
View, but group by the Service Year and by the Service Month Number.
Sort (within each group) by the Customer Name. Use the “Stepped” layout and the Formal style.
Notice, the Service Month Number footer is missing.
Click on the Sorting and Grouping button,
, from the main toolbar.
Form the Service Month Number field, set the group footer to YES.
Edit the Page Header. Move the Service Year data field and the Service Month field to the Service
Month Number Header.
*** continues on the next page ***
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 29
In the Service Month Number footer, calculate the number of services charges and the monthly service
charge for each month of the table. In the Report Footer, calculate the total service charge.
Car Ownership by Year and Model Report. Use the Car Ownership Query. Select all files.
View by the Car. Group by Year and by the Model. Sort by the Last name and first name. Use a
stepped layout and use the Formal style. Edit the structure.
Customer from Desired City Report. Use the Customer from Desired City Query. Display
the last name, first name, city, and phone number. View by the Customer; no grouping. Sort by the
last name and first name. Use a Tabular layout and a Formal style. Move the city to the Report
Header section. Complete the report.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 30
Create new labels, named Notice of Next Oil Change Labels. On the Report section, Click on
NEW, Label Wizard to create labels. Use the Notice of Next Oil Change Query.
Setup the labels for Avery 5161 label sheets (English units). Use the font TimesNewRoman 10 point.
Create the following label structure.
When opening the labels (do not actually print), the labels should look similar to the following:
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 31
Mail Merge
Problem: Next Oil Change
In Microsoft WORD, create a new document, named NextOilChangeLetterUsername.
Prepare the merge document file
• Click on View, Toolbar, Mail Merge from the menu bar
•
•
•
•
Click on Open Data Source button,
, from the merge toolbar.
Select your Scorpion database file.
All of the tables and queries will be displayed. Select Notice of Next Oil Change Query
Click on <OPEN>
Create the letterhead. Click on Insert, Picture, From File
Switch to your MBA610\SCORPION folder and select the SCORPION.GIF image.
*** problem continues on the next page ***
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 32
Select the image and click on Format, Picture. Click on the Layout tab and the Advanced button.
Set the position of the image at 0.3” from the top left corner of the page. .
Click on the Text Wrapping tab. Select Top and Bottom.
Click on the
button.
Click on the Size tab and set the width to 5.6”. .
Click on the
button.
*** problem continues on the next page ***
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 33
The Scorpion letterhead should look like the following.
For a business letter, insert today’s date (so that the correct date is always printed) below the logo.
• On the blank row below the company logo, change the paragraph alignment to CENTER.
• From the menu bar, click on Insert, Date and Time
•
Select the full date structure and check “Update Automatically.”
•
Click on OK
The document should look like the following. Save.
*** problem continues on the next page ***
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 34
Write the following merge document. Save often. Click on the
(insert merge fields) button from
the merge toolbar to insert each of the data fields (shown with a gray background – your fields may not
be shaded – that is ok). Remember to place a space after <<First_Name>>, <<City>>, and <<State>>.
This letter is designed to remind the customer that the last oil change was approximately 3 months ago.
Engine oil needs to be changed every 3,000 miles or 3 months. The letter includes the last service
date, the year and model of the vehicle, and the mileage at the last oil change. A sales promotion
encourages the customer to return to Scorpion Car Co (Script MT Bold – or other script font) for their
next oil change.
Save.
Do the Mail Merge (the merge document file is already open)
•
•
•
•
Click on the Merge to New Document button,
Select all records.
Check each page of the document.
Do NOT save this document.
from the merge toolbar.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 35
Problem: Viper Promotion.
Beginning next month, the Scorpion Car Company (Script MT bold or other script type font) is
providing a special sales incentive on the Viper. Previous owners of Vipers and Cobra XT cars are 6
times more likely to purchase a Viper than previous owners of Cobra, Stinger, or Stinger LX cars.
Send a promotional letter to all previous owners of Vipers and Cobra XT cars where the model year is
2 or more years old. On the Internet, find a picture of a high-end sports car to represent the Viper. Use
this picture in your letter.
• In Microsoft Access, open the Scorpion database file.
• Create a new query, Viper Promotion Query. Select all records where ([model]=”Viper” OR
[model]=”Cobra XT”) AND [year]<= Year(Date())-2
(Attempt to create the query in the design mode, but switch to the SQL mode to correct the
WHERE clause.) Check the query to make sure the proper records are being displayed.
• Create mailing labels, Viper Promotion Labels, to send letters to these customers.
• Create a mail merge data document, Viper Promotion. Use the Viper Promotion Query as
the data source.
• Create a mail merge letter, Viper Promotion Letter. Search the Internet for a picture of a highend sports car; include this picture the letter.
• Merge the documents. Do not print.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 36
Exporting Data to Excel
Problem: Count of Car Model
Open the Scorpion database in Microsoft Access. Export the Count of Car Model for Desired
Model Year Query to an Excel worksheet file.
• Select (but not open) the Count of Car Model for Desired Model Year Query.
• Click on File
• Click on Export
• Change to your individual course folder on the S:\ drive.
• Change Type to Microsoft Excel 97-2003.
• Save using the filename, CountOfCarModelUsername.
• Click on <Export>
• Select a model year that has a large number of car sales.
In Microsoft Excel, open the Count of Car Model worksheet. Insert a column before column A and
3 rows before row 1. The table should look similar to the following.
Delete the years from column D. Calculate a total at the bottom of the table. Complete the table.
*** continues on the next page ***
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 37
Adjust the width of column A to center the table in the window. Select the models and the number of
cars sold.
Click on
and create a column graph to compare the number of cars sold for each type of car sold
in the year 2001. Place the graph below the table in column A. Enlarge to fill the screen. Complete
the graph.
Scorpion Car Co
2001 Annual Sales
5
Cars
4
3
2
1
0
Cobra
Cobra XT
Stinger LX
Viper
Model
In File, Page Setup, Select
*** continues on the next page ***
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 38
Write a memo to Ms. Carolyn Simmons, dealership manage. Use letterhead at the top of the memo.
Write a short paragraph describing the analysis.
Include the graph. In Excel, select the graph. Click on Copy.
In the Word document (at the end of the memo), click on Edit, Paste Special. Select an option that is
closest to a picture.
Format the graph to be In Line with Text.
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 39
Problem: Survey.
Export the Survey table to an excel 97-2003 worksheet file. Use the filename, SurveyUsername.
Open the Excel file.
Select the data in the “Courteous” column.
Name this range, Courteous.
Repeat the process with each of the other columns. Name each Explain, Quality, Time, and
Recommend.
Create a new worksheet. Click on Insert, Worksheet from the toolbar.
*** continues on the next page ***
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 40
Create the following table structure.
The COUNTIF(range,criteria) function is used to calculate the number of people responding to
each statement at that level of response. For the first statement (row 8), Courteous (the range of cells
on the first sheet that indicates the responses to the “Courteous” survey question) is the data range.
The criteria is similar to writing a criteria in an Excel query. Remember, “no operator” is assumed to
be “equal to”. For the first cell, C8, the criteria is cell C5, which is left relative so that it will change
as the formula is being copied across. Enter the formula.
C8
=COUNTIF(Courteous,C5)
Copy this formula across to cell I8.
Write a similar formula for each of the remaining 4 statements.
The average in cell J8 is NOT the average of the cells, C8:I8; but the average of the responses to the
“Courteous” survey question – these values are found in the range, Courteous. Use the
AVERAGE(range) function to calculate the average response to each statement. Format each to the
nearest hundredth. The table should look similar to:
Adjust the width of columns A and K so that the table appears centered in the window. Below the
table (in column A) create a column graph comparing the average response (J8:J12) for each survey
question (B8:B12). On step 3 of the chart wizard, show the value of the data labels.
*** continues on the next page ***
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 41
Select the Y-axis. Click on Format, Selected Axis from the menu bar.
Click on the Scale tab. Set the Minimum to 1, the Maximum to 7 (remove the check), the Major Unit
to 1 (remove the check), and the Category X axis Crosses at 4.
Click on the
button.
The graph should look similar to the following:
Scorpion Car Co
Monthly Survey Response (Jan 2003)
7.00
6.53
6.51
6.26
Quality
Time
6.00
4.84
5.00
Response
6.00
4.00
3.00
Courteous
Explain
Recommend
2.00
1.00
Statement
None of the responses indicate a disagreement with the statement (average response below 4.00). An
average response of 6.00 or higher indicates an acceptable agreement with the statement.
*** continues on the next page ***
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 42
Because the response to the “Explain” statement was a weak agreement, Carolyn Simmons, the
dealership manager, wanted a breakdown of the responses. Create a histogram (column graph) of the
number of people responding at each level of response of the “Explain” statement. On step 3 of the
chart wizard, show the value of the data labels. Place this graph below the first graph.
Select the data series. Click on Format, Selected Data Series from the menu bar.
Click on the Options tab. Set the gap width to 0.
Click on
button.
The histogram should look similar to the following.
Scorpion Car Co
Histogram of the Explain Statement Responses (Jan 2003)
30
25
28
18
People
20
15
12
10
5
10
4
2
0
0
7
6
5
4
Response Level
3
2
1
In Word, write a memo to Ms. Carolyn Simmons, the dealership manager. State the results of the
January 2003 survey. Include both graphs (In Line With Text at the bottom of the memo – one of the
graphs will probably go to page 2).
MBA 610: Database Queries and Reports / Mail Merge / Spreadsheet Analysis
Page 43
© Copyright 2026 Paperzz