Database assignment II
In this assignment you create a database of products
for a store that sells coffee. You need a Microsoft Access 2010 or later.
If you need a copy of Access and you have Windows, then you can get a copy
as part of the Microsoft program that Kishwaukee CIS is a part of.
Students currently enrolled in an active qualifying
CIS course can download, install, and use a full copy of Access
for their personal non-commercial use on their personal computer.
Access does not run on Mac.
This problem uses a number of features of Access and it is
expected that there will be questions. Keep in mind that the CIS 123 website
has a FAQ sheet for using Access, there will be a demonstration of Access in
one of the optional class sessions, and there are many tutorials on how to
use specific features in Microsoft Access on the Web.
This is particularly useful if you want a question answered quickly
outside of class time and you don't have an Access reference at hand.
- Download and save your individualized starting Access database and
Excel workbook which you can get here.
Remember where you download your files. Make sure you close Access BEFORE you
upload your .accdb database file to the dropbox in Desire2Learn.
- Do NOT work closely together or copy or share work with other students.
The penalties can be quite severe. You are welcome to ask all the questions you
want and to seek help from the instructor.
- The database you download will already contain one table named Weight.
- Keep in mind when creating tables that you have to set the required
property of a field to Yes to make it required.
- Note: In newer versions of Access, a text field that has a short length (<= 255) is
considered a "Short Text" field for its data type.
- Create a new table named Product using the Table Design view.
It should have the following five fields, and ONLY the following five fields: (5 pts)
- ProductID: text field, 4 characters long, required, primary key
- CoffeeCode: text field, 4 characters long, required
- WeightCode: text field, 1 character long, required
- Decaf: text field, 1 character long, default value of D, not required
- Price: currency field, required
- You might want to check to make sure you have the required property set to Yes for the
four fields above which listed that.
- Copy and paste the data from the Inventory.xlsx workbook
into the rows (records) of the Product table you just created. (2 pts)
- Delete the record with ProductID 2372 from the Product table. (1 pt)
- Create a new table named Coffee by importing
the data from the coffee.mdb file. (3 pts)
- Change the field names to camel-casing. [This has to be done in datasheet
view.] Camel-casing means that the first letter of every word in a field
name should be uppercase, while all other letters should be lowercase.
One example is that COFFEENAME would become CoffeeName. This step has to be done
manually in datasheet view. Right click on a column name, choose Rename, and
then manually type in the camelcase version. (1 pt).
- Make the CoffeeCode field the primary key. (1 pt)
- Change the format for the Decaf field to "True/False". This can be done in design
view by changing the Format property for the Decaf field. (1 pt)
- Close the Coffee table.
- Using the Product table and query design view, create a query to find the ProductID,
WeightCode, and Price where CoffeeCode is equal to "BRUM". Have
the query sort the results in descending order by price, and don't
show the CoffeeCode field. The sort is required to be done in design
view, NOT datasheet view. Name the query BrumCoffees. (3 pts)
Note: The results of this query will look a little different after you change
the data for the product with ProductID 2410 later in this project.
- Note: The next step requires you to create a relationship. All tables and queries
should be closed while you are creating a relationship.
- Use the Relationships button on the toolbar of the Database Tools tab
to relate the Coffee, Weight, and Product tables using the appropriate
fields. Select ALL of the options to enforce referential integrity.
This includes enforce referential integrity, cascade update related fields,
and cascade delete related records. (3 pts)
- Create a new query in design view using all three tables
- display the CoffeeType, CoffeeName, ProductID, Product.Decaf,
Price and WeightSize fields (2 pts)
- sort the data in ascending order based on the CoffeeName field; the sort
is required to be done in design view (NOT datasheet view) (1 pt)
- have the query only display records where the CoffeeType field
equals "Flavored" (1 pt)
- save the query with the name FlavoredCoffees (1 pt)
- Create a new query based on the Product table using design view
- display all fields from the Product table except "Decaf" (1 pt)
- have the query only display records where the WeightCode field
is not "A", and whose price is > 50 (4 pts)
- add a calculated field named NewPricing that adds
3% to price; do NOT add a new field to the Product table - the NewPricing field
should only exist in this query (3 pts)
- modify the format of the NewPricing field to be currency format [You can change
the format of a field by right clicking on the column header in design view and choosing
to show the properties. The properties list should have a Format property where you can
select Currency.] (1 pt)
- sort the data in descending order based on the NewPricing field; the sort
is required to be done in design view (NOT datasheet view) (1 pt)
- save the query with the name NewPrices (1 pt)
- Create a new query based on the Product table using design view
- Note: This query uses what are called aggregate functions (min, max, count, average, etc.).
Add whatever fields you want to perform such a function on. Add the field once for each
aggregate function you want to perform on it. The Totals button on the toolbar can then
be used to display the Total line in design view. The Total line lets you choose which
aggregate function you want to perform. It is also used for grouping data.
- create a field named LowestPrice and have it display
the minimum price among all the records; remember to change the name of this field
in the query (2 pts)
- create a field named HighestPrice and have it display
the maximum price among all the records; remember to change the name of this field
in the query (2 pts)
- save the query with the name LowestAndHighestPrices (1 pt)
- check to make sure your results are correct
- create a form based on the Product table
- use the Form Wizard
- use all the fields from the Product table (1 pt)
- the form should use a columnar layout (1 pt)
- save the form with the name Product Data
- update the Product table using the Product Data form
- find ProductID 2410 and make the following changes (1 pt)
- change the WeightCode field value to A
- change the Decaf field value to D
- change the Price field value to 8.99
- find and delete the record with ProductID 4306 (1 pt)
- add a new record with the following values (1 pt)
- ProductID: 2306
- CoffeeCode: AMAR
- WeightCode: A
- Decaf: nothing
- Price: 7.99
- close the form
- reopen the form and make sure the new record is now in order by ProductID
- use the Report Wizard to create a report
- use the Coffee table as the primary table (choose it first)
and use all fields in the Coffee table except the Decaf field (1 pt)
- use the Product table as the related table (choose it after the Coffee table)
and use all fields in the Product table except the CoffeeCode field (1 pt)
- have the report show the data by Coffee (it should already be
selected since it is the default)
- specify CoffeeType as an additional grouping level (1 pt)
- sort the detail records in ascending order by ProductID (1 pt)
- leave the report with the default Stepped, Portrait layout
- Save the report and name it ProductDetails
- Submit your database file to the Desire2Learn assignment dropbox when you
are finished. Make sure you have Access completely closed BEFORE you
submit your file and make sure the file you submit has the .accdb extension.
If you submit a file with a .lccdb extension, then you didn't
shut down Access before submitting the file and you have submitted a
file which is useless. If you submit a file with a .lnk extension, then
you have submitted a shortcut, which is also useless for grading.
Resources
- Excel workbook with Product table data for import
- Old Access format file with Coffee table for import
- BrumCoffees query results
- Relationship result
- FlavoredCoffees query results
- NewPrices query results
- LowestAndHighestPrices query results
- ProductDataForm
- ProductDetails report
There are 50 points total available for this assignment. Remember
that there is a discussion forum available for asking questions about
this assignment. There is also an Access FAQ page available on the CIS 123
web site. Class is also a great time to demonstrate Access usage questions,
so feel free to bring in questions to a class session.