You are on page 1of 3

Exercise: Understanding Data Modeling techniques for Multi-Dimensional Data management With

Relationships

EXERCISE
Data Files needed for the Exercise:
LuckyTire.accdb
Customers.csv
Sales.xlsx

Keywords: Tables, Data types, Field Level Constraints, Record level Constraints; Query, Group by query,
Order by query, Simple Join, etc.

Len Phan, the owner of Lucky Tire, has asked you to expand the LuckyTire database to store additional
company data, after seeing how comfortable you are working with Access. He asks you to include
customer and sales information. You decide to add a table for customers, and a third table that tracks
customers tire purchases.

1. Start Access and open the LuckyTire database. Save the database where you save your data files. If
the Security Warning is displayed, click the Options button, click the Enable the content button, and
then click OK.
2. Open the Tires table and in Design View, set the following field properties:
Field Name Data Type Field Size
PartID Text 5
Model Name Text 20
Manufacturer Text 20
Unit Price Currency 2 Decimal Places
Type Text 12

3. Save and close the Tires table.


4. Len exported the customer data that he was maintaining in another computer system to a text file,
Import the data from Customers.csv into a new table in the LuckyTire database.
Specify Customers.csv as the source of your data.
Select import in a delimited format.
Select comma delimited and click the First Row Contains Field Names checkbox.
Select the Indexed option Yes (No Duplicates).
Choose CustID as the primary key.
Name the new table Customers. (Do not save import steps.)
5. Open the Customers table. Resize the columns as necessary to fit the data, and then set the following
properties for the fields:
Field Name Data Type Description Field Size
CustID Text Primary Key 5
First Name Text 20
Last Name Text 20
Address Text 35
City Text 25
State Text 2
Zip Text 5
Phone Text 14
Make Text 15
Model Text 15

Course coordinator: Dr Ashim Raj Singla


1of 3
Exercise: Understanding Data Modeling techniques for Multi-Dimensional Data management With
Relationships

Year Text 4

6. Save and close the Customers table.


7. Use Design View to create a new table named Sales using the follow table design.
Field Name Data Type Description Field Size
Invoice Text Primary Key 5
InvoiceDate Date/Time Short Date
CustID Text Foreign Key 5
PartID Text Foreign Key 5
Quantity Number Long Integer

8. Add the following two records to the Sales table, and then save the table.
Invoice Date CustID PartID Quantity
77340 5/5/2008 50173 Y450T 1
77341 5/5/2008 50211 G812T 1

9. Len has been tracking recent Lucky Tire sales information in an Excel spreadsheet, Sales.xlsx. Append
a copy of the records from Sales to the Sales table.
10. Open the Sales table. Resize all of the columns to their best fit, then save and close the Sales table.
11. Because every sales order needs to have a customer, define the one-to-many relationship between the
primary Customer table and the related Sales table. Select the Enforce Referential Integrity option and
Cascade Update Related Fields option for this relationship.
12. Because every customer sale needs to include a tire model, define the one-to-many relationship
between the primary Tires table and the related Sales table. Select the Enforce Referential Integrity
option and Cascade Update Related Fields option for this relationship.
13. Save the changes to the Relationships Window.

Reporting:
Lucky Tires owner Len Phan is considering opening a new branch in Upland and wants you to provide
information on customers in that city. He also has some tire special coming up and wants you to identify
customers for promotional mailings. In addition, he has some corrections to existing data in the database.

14. Start Access and open the LuckyTire database. Save the database where you save your data files.
15. In the Customer table, change the phone number for Mike Lee to 909-555-4852 and change Maria
Agbayanis street address to 1010 W E St #403. Change the background color to Access Theme 4.
Close the table.
16. In the Tires table, locate Part ID P476X. Check to see if there is any data in the subdatasheet for
P476X, and then delete the record. Close the table.
17. Use Design View to create a query that identifies all of the customers who live in Upland. Select the
First, Last, and City fields from the Customer table. Enter Upland in the City Criteria text box and do
not display this field. Sort the results in alphabetical order by last name. Save the query as Upland
Customers and run the query.
18. After reviewing the list of customers living in Upland, Len wants to see how many customers live in
all of the surrounding towns. Use Design View to create a query that counts the number of customers

Course coordinator: Dr Ashim Raj Singla


2of 3
Exercise: Understanding Data Modeling techniques for Multi-Dimensional Data management With
Relationships

in each town. Select the City and CustID fields from the Customer table. Show the Total row in the
query design view. In the Total row, select Group By Count for the CustID field. Save the query as
Town Totals and run the query. Close both queries.
19. For the first promotion, Len wants you to identify customers who have purchased GoodTread Tires.
Using Design View, select the First, Last, Address, City, State, and Zip fields from the Customer table
and Manufacturer from the Tires table. Enter GoodTread in the Manufacturer Criteria text box, and do
not display this field. Show the Total row in the query design view. Sort the records in ascending order
by Zip. Save the query as GoodTread Promotion, and run the query. Close the query.
20. For the second promotion, Len needs the names and addresses of Hondas or Toyotas owners. Copy the
GoodTread Promotion query, and name it Honda-Toyota Promotion. Delete the Manufacturer field
from the query and then delete the Tires and the Sales tables from the query window. Select the Make
field from the Customer table. Enter Honda in the Make Criteria text box, and enter Toyota in the or
text box below. Do not display the Make field. Sort the records in ascending order by Zip. Run the
query. Save and close it.
21. Now Len wants to see the sales figures for each tire manufacturer. Use Design View to create a query
that calculates the total sales per manufacturer. Select the Manufacturer and Unit Price fields from the
Tires table and the Quantity from the Sales table. Use Builder to create a field that displays Unit Price
multiplied by Quantity. Name this field Income. Show the Total row in the query window, and make
the following selections: calculate the average of the Unit Price field; the sum of the quantity field; and
the sum of the Income field. Sort the records in ascending order by the Manufacturer field. Save the
query as Manufacturer Sales and run the query. From the query datasheet window, click the Totals
button in the Records group. Calculate the total quantity and total income of all the manufacturers.
Save and close the query.
22. Close any open tables or queries. Compact and repair the database. Close the LuckyTire database, and
then close Access.

Course coordinator: Dr Ashim Raj Singla


3of 3

You might also like