Week 3 Written Assignment
Week 3 Written Assignment
The Queen Anne Curiosity Shop wants to expand its database applications beyond the current recording of
sales. The company still wants to maintain data on customers, employees, vendors, sales, and items, but it
wants to (a) modify the way it handles inventory, and (b) simplify the storage of customer and employee data.
Currently, each item is considered unique, which means that the item must be sold as a whole, and
that multiple units of the item in stock must be treated as separate items in the ITEM table.
The Queen Anne Curiosity Shop management wants the database modified to include an inventory
system that will allow multiple units of an item to be stored under one ItemID.
The system should allow for a quantity on hand, a quantity on order, and an order due date. If the
identical item is stocked by multiple vendors, the item should be orderable from any of these
vendors.
The SALE_ITEM table should then include Quantity and ExtendedPrice columns to allow for sales
of multiple units of an item.
Some of the fields in CUSTOMER and EMPLOYEE store similar data. Under the current system,
when an employee buys something at the store, his or her data has to be reentered into the
CUSTOMER table. The managers would like to have the CUSTOMER and EMPLOYEE tables
redesigned using subtypes.
For this assignment use the following Queen Anne Curiosity Shop database
schema from chapter 3
CUSTOMER (CustomerID, LastName, FirstName, Address, City, State, ZIP, Phone, Email)
EMPLOYEE (EmployeeID, LastName, FirstName, Phone, Email)
VENDOR (VendorID, CompanyName, ContactLastName, ContactFirstName,
Address, City, State, ZIP, Phone, Fax, Email)
ITEM (ItemID, ItemDescription, PurchaseDate, ItemCost, ItemPrice, VendorID)
SALE (SaleID, CustomerID, EmployeeID, SaleDate, SubTotal, Tax, Total)
SALE_ITEM (SaleID, SaleItemID, ItemID)
REMEMBER: Foreign keys, in italic, are not listed in a table when drawing an E-R data model
Use the tools below to create the E-R diagram as demonstrated in class.
2 | Page
A.
(10 points) Draw an E-R data model for the Queen Anne Curiosity Shop database schema shown on
page 1. Use the IE Crows Foot E-R model for your E-R diagrams. Justify the decisions you make
regarding minimum and maximum cardinality.
CARDINALITY
CHILD
TYPE
MAX
MIN
CUSTOMER
SALE
Strong Type
1:N
M-O
EMPLOYEE
SALE
Strong Type
1:N
M-O
SALE
SALE_ITEM
Id Dependent Type
1:N
M-M
ITEM
SALE_ITEM
Strong Type
1:1
M-O
VENDOR
ITEM
Strong Type
1:N
M-O
3 | Page
SaleID
LastName
FirstName
Phone
Email
SaleDate
SubTotal
Tax
Total
CUSTOMER
EMPLOYEE
SALE
EmployeeID
CustomerID
LastName
FirstName
Address
City
State
ZIP
Phone
Email
SALE_ITEM
SaleID
SaleItemID
VENDOR
VendorID
ITEM
ItemID
ItemDescription
PurchaseDate
ItemCost
ItemPrice
CompanyName
ContactLastName
ContactFirstName
Address
City
State
ZIP
Phone
Fax
Email
4 | Page
B.
(10 points) Extend and modify the E-R data model by adding only the Queen Anne Curiosity Shops
inventory system requirements. Use the IE Crows Foot E-R model for your E-R diagrams. Create
appropriate identifiers and attributes for each entity. Justify the decisions you make regarding minimum
and maximum cardinality.
1. When an Item is purchased from a Vendor they get an Order receipt.
2. Record the date when an Order is made and when the Order is received.
3. Record the original cost of a single item on the Order.
4. Store how many items were purchased on the Order.
5. Each order has a subtotal of the items, how much tax was applied and the total cost of
each Order.
6. Eliminate redundant information from the Item model in part A.
7. Add the ability to track what is on-hand and what is on-order in the Item model.
8. Sale_Items can now have a quantity and an extended price.
CHILD
CARDINALITY
TYPE
ITEM
SALE_ITEM
Strong type
ITEM
ORDER
Strong type
VENDOR
ORDER
Strong type
MAX
MIN
5 | Page
CUSTOMER
SALE
EMPLOYEE
CustomerID
SaleID
EmployeeID
LastName
FirstName
Address
City
State
ZIP
Phone
Email
SaleDate
SubTotal
Tax
Total
LastName
FirstName
Phone
Email
VENDOR
SALE_ITEM
VendorID
SaleID
SaleItemID
CompanyName
ContactLastName
ContactFirstName
Address
City
State
ZIP
Phone
Fax
Email
Quantity
ItemPrice
ITEM
ItemID
ORDER
InvoiceNumber
DateOrdered
DateRecieved
QuantityOrdered
ItemCost
OrderSubTotal
OrderTax
OrderTotalCost
ItemDescription
RecorderPointQuantity
QuanityOnHand
ItemPrice
6 | Page
C.
(10 points) Extend and modify the E-R data model by adding only the Queen Anne Curiosity Shops
need for more efficient storage of CUSTOMER and EMPLOYEE data. Use the IE Crows Foot E-R
model for your E-R diagrams. Create appropriate identifiers and attributes for each entity. Justify the
decisions you make regarding minimum and maximum cardinality.
1. A Person can be a Customer or Employee or both.
2. A Person has all of information from the Customer model Part A.
3. Customer and Employee are subtypes of a Person.
4. Store the card type, card number and expiration date of the credit card a Customers
uses.
5. Keep track of when an Employee is hired and their rate of pay.
6. Use the primary key of the supertype for each subtype.
7.
CHILD
CARDINALITY
TYPE
MAX
MIN
PERSON
CUSTOMER
1:N
M-O
PERSON
EMPLOYEE
1:N
M-O
7 | Page
PERSON
PersonID
IsEmployee
IsCustomer
LastName
FirstName
Address
City
State
Zip
Phone
Email
SALE
SaleID
CUSTOMER
SALE_ITEM
SaleItemID
ItemPrice
VENDOR
VendorID
ITEM
CompanyName
ContactLastName
ContactFirstName
Address
City
State
ZIP
Phone
Fax
Email
ItemID
ItemDescription
PurchaseDate
ItemCost
ItemPrice
EMPLOYEE
CreditCardType
CreditCardNumber
CreditCardExpiratioDate
SaleDate
SubTotal
Tax
Total
DateOfHrs
HourlyPayRate
8 | Page
D.
(10 points) Combine the E-R data models from parts B and C to meet all the Queen Anne Curiosity
Shops new requirements, making additional modifications, as needed. Use the IE Crows Foot E-R
model for your E-R diagrams.
PERSON
PersonID
IsEmployee
IsCustomer
LastName
FirstName
Address
City
State
Zip
Phone
Email
CUSTOMER
SALE
CreditCardType
CreditCardNumber
CreditCardExpiratioDate
EMPLOYEE
PERSONID
SaleID
PersonID
SaleDate
SubTotal
Tax
Total
DateOfHrs
HourlyPayRate
VENDOR
VendorID
SALE_ITEM
CompanyName
ContactLastName
ContactFirstName
Address
City
State
ZIP
Phone
Fax
Email
SAleID
SaleItemId
Quantity
ItemPrice
ORDER
InvoiceNumber
ITEM
DateOrdered
DateRecieved
QuantityOrdered
ItemCost
OrderSubTotal
OrderTax
OrderTotalCost
ItemID
ItemDescription
ReorderPointQuanity
QuantityOnHand
ItemPrice