1 | Page 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 uni!ue, which means that the item must be sold as a whole, and that multiple units of the item in stoc" must be treated as separate items in the #T$% 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 #tem#&. The system should allow for a !uantity on hand, a !uantity on order, and an order due date. #f the identical item is stoc"ed by multiple vendors, the item should be orderable from any of these vendors. The SA'$#T$% table should then include Quantity and $xtended)rice columns to allow for sales of multiple units of an item. Some of the fields in C*ST+%$ and $%)'+-$$ store similar data. *nder the current system, when an employee buys something at the store, his or her data has to be reentered into the C*ST+%$ table. The managers would li"e to have the C*ST+%$ and $%)'+-$$ 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, Phoe, Emai!" EMPLO#EE (Em$!oyeeID, LastName, FirstName, Phoe, Emai!" %ENDOR (%edorID, Com$ayName, Cota&tLastName, Cota&tFirstName, Address, City, State, ZIP, Phoe, Fa', Emai!" ITEM (ItemID, ItemDes&ri$tio, Pur&haseDate, ItemCost, ItemPri&e, endor#& endor#&"" SALE (Sa!eID, Customer#& Customer#&,, $mployee#& $mployee#&,, Sa!eDate, SuTota!, Ta', Tota!" SALE)ITEM (Sale#& ( Sale#&,, Sa!eItemID, #tem#& #tem#&""
REE!ER: 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. • • • •
The only MA !ardinality !ardinality are ":" and ":#. " $or %ne and # $or Many&Think Many&Think '#o-limit() The only M*# !ardinality !ardinality are M:M and M:%. M:%. M $or Mandatory and % $or $or %+tional The direction o$ o$ the relationshi+ does does not matter hen yo hae an arrow selected yo can se the F%RMAT Tab to Rotate it.
" | Page
A.
(/0 points &raw an $1 data model for the Queen Anne Curiosity Shop database schema shown on page /. *se the #$ Crow2s 3oot $1 model for your $1 diagrams. 4ustify the decisions you ma"e regarding minimum and maximum cardinality.
#se this chart for $art A RELATIONSHIP PARENT
CARDINALITY
CHILD
TYPE
MAX
MIN
CUSTOMER
SALE
Stro* Ty$e
+N
M-O
EMPLO#EE
SALE
Stro* Ty$e
+N
M-O
SALE
SALE)ITEM
Id De$edet Ty$e
+N
M-M
ITEM
SALE)ITEM
Stro* Ty$e
++
M-O
%ENDOR
ITEM
Stro* Ty$e
+N
M-O
/ !U0T%MER / &Mst1May) hae a&n) // // &Mst1May) hae a&n) / !U0T%MER /
/ !U0T%MER / can hae &%ne1Many) // // can hae &%ne1Many) / !U0T%MER /
/ EMP2%3EE / &Mst1May) hae a&n) // // &Mst1May) hae a&n) / EMP2%3EE /
/ EMP2%3EE / can hae &%ne1Many) // // can hae &%ne1Many) / EMP2%3EE /
/ 0A2E / &Mst1May) hae a&n) // // &Mst1May) hae a&n) / 0A2E /
/ 0A2E / can hae &%ne1Many) // // can hae &%ne1Many) / 0A2E /
/ *TEM / &Mst1May) hae a&n) // // &Mst1May) hae a&n) / *TEM /
/ *TEM / can hae &%ne1Many) // // can hae &%ne1Many) / *TEM /
/ 4E#5%R / &Mst1May) hae a&n) // // &Mst1May) hae a&n) / 4E#5%R /
/ 4E#5%R / can hae &%ne1Many) // // can hae &%ne1Many) / 4E#5%R /
3 | Page
E E 3 % 2 P M E
E 2 A 0
Em+loyee*5
0ale*5
2ast#ame First#ame Phone Email
0ale5ate 0bTotal Ta7 Total
R E M % T 0 U !
!stomer*5 2ast#ame First#ame Address !ity 0tate 6*P Phone Email
M E T * / E 2 A 0
0ale*5 0ale*tem*5
R % 5 # E 4
4endor*5 M E T *
*tem*5 *tem5escri+tion Prchase5ate *tem!ost *temPrice
!om+any#ame !ontact2ast#ame !ontactFirst#ame Address !ity 0tate 6*P Phone Fa7 Email
% | Page
5.
(/0 points $xtend and modify the $1 data model by adding o!y the Queen Anne Curiosity Shop2s inventory system re!uirements. *se the #$ Crow2s 3oot $1 model for your $1 diagrams. Create appropriate identifiers and attributes for each entity. 4ustify the decisions you ma"e regarding minimum and maximum cardinality.
". hen an *tem is +rchased $rom a 4endor they get an %rder recei+t. 8. Record the date when an %rder is made and when the %rder is receied. 9. Record the original cost o$ a single item on the %rder. . 0tore how many items were +rchased on the %rder. ;. Each order has a sbtotal o$ the items, how mch ta7 was a++lied and the total cost o$ each %rder. <. Eliminate redndant in$ormation $rom the *tem model in +art A. =. Add the ability to track what is on-hand and what is on-order in the *tem model. >. 0ale/*tems can now hae a ?antity and an e7tended +rice.
#se this chart for $art ! RELATIONSHIP PARENT
CHILD
CARDINALITY TYPE
ITEM
SALE)ITEM
Stro* ty$e
ITEM
ORDER
Stro* ty$e
%ENDOR
ORDER
Stro* ty$e
MAX
/ *TEM / &Mst1May) hae a&n) // // &Mst1May) hae a&n) / *TEM /
/ *TEM / can hae &%ne1Many) // // can hae &%ne1Many) / *TEM /
/ *TEM / &Mst1May) hae a&n) // // &Mst1May) hae a&n) / *TEM /
/ *TEM / can hae &%ne1Many) // // can hae &%ne1Many) / *TEM /
/ 4E#5%R / &Mst1May) hae a&n) // // &Mst1May) hae a&n) / 4E#5%R /
/ 4E#5%R / can hae &%ne1Many) // // can hae &%ne1Many) / 4E#5%R /
MIN
& | Page
E 2 A 0
E E 3 % 2 P M E
!stomer*5
0ale*5
Em+loyee*5
2ast#ame First#ame Address !ity 0tate 6*P Phone Email
0ale5ate 0bTotal Ta7 Total
2ast#ame First#ame Phone Email
R E M % T 0 U !
R % 5 # E 4
M E T * / E 2 A 0
4endor*5
0ale*5 0ale*tem*5
!om+any#ame !ontact2ast#ame !ontactFirst#ame Address !ity 0tate 6*P Phone Fa7 Email
@antity *temPrice
M E T *
*tem*5
R E 5 R %
*noice#mber 5ate%rdered 5ateRecieed @antity%rdered *tem!ost %rder0bTotal %rderTa7 %rderTotal!ost
*tem5escri+tion RecorderPoint@antity @anity%nand *temPrice
' | Page
C.
(/0 points $xtend and modify the $1 data model by adding o!y the Queen Anne Curiosity Shop2s need for more efficient storage of C*ST+%$ and $%)'+-$$ data. *se the #$ Crow2s 3oot $1 model for your $1 diagrams. Create appropriate identifiers and attributes for each entity. 4ustify the decisions you ma"e regarding minimum and maximum cardinality.
". A Person can be a !stomer or Em+loyee or both. 8. A Person has all o$ in$ormation $rom the !stomer model Part A. 9. !stomer and Em+loyee are sbty+es o$ a Person. . 0tore the card ty+e, card nmber and e7+iration date o$ the credit card a !stomers ses. ;. Bee+ track o$ when an Em+loyee is hired and their rate o$ +ay. <. Use the +rimary key o$ the s+erty+e $or each sbty+e. =.
#se this chart for $art C RELATIONSHIP PARENT
CHILD
CARDINALITY TYPE
MAX
MIN
PERSON
CUSTOMER
Id De$edet I&!usi.e Suty$e
+N
M-O
PERSON
EMPLO#EE
Id De$edet I&!usi.e Suty$e
+N
M-O
/ PER0%# / &Mst1May) be a&n) // // &Mst1May) hae a&n) / PER0%# /
/ PER0%# / can be &%ne1Many) // // can be &%ne1Many) / PER0%# /
/ PER0%# / &Mst1May) be a&n) // // &Mst1May) be a&n) / PER0%# /
/ PER0%# / can be &%ne1Many) // // can be &%ne1Many) / PER0%# /
( | Page
# % 0 R E P
Person*5 *sEm+loyee *s!stomer 2ast#ame First#ame Address !ity 0tate 6i+ Phone Email
E 2 A 0
0ale*5 R E M % T 0 U !
!redit!ardTy+e !redit!ard#mber !redit!ardE7+iratio5ate
0ale5ate 0bTotal Ta7 Total
M E T * / E 2 A 0
0ale*tem*5 *temPrice
R % 5 # E 4
4endor*5 !om+any#ame !ontact2ast#ame !ontactFirst#ame Address !ity 0tate 6*P Phone Fa7 Email
M E T *
*tem*5 *tem5escri+tion Prchase5ate *tem!ost *temPrice
E E 3 % 2 P M E
5ate%$rs orlyPayRate
) | Page
&.
(/0 points Combine the $1 data models from parts B and C to meet all the Queen Anne Curiosity Shop2s new re!uirements, ma"ing additional modifications, as needed. *se the #$ Crow2s 3oot $1 model for your $1 diagrams. # % 0 R E P
Person*5 *sEm+loyee *s!stomer 2ast#ame First#ame Address !ity 0tate 6i+ Phone Email
R E M % T 0 U !
PER0%#*5 !redit!ardTy+e !redit!ard#mber !redit!ardE7+iratio5ate
E 2 A 0
0ale*5
Person*5
0ale5ate 0bTotal Ta7 Total
5ate%$rs orlyPayRate
R % 5 # E 4
4endor*5 !om+any#ame !ontact2ast#ame !ontactFirst#ame Address !ity 0tate 6*P Phone Fa7 Email
M E T * / E 2 A 0
0Ale*5 0ale*tem*d @antity *temPrice
R E 5 R %
*noice#mber 5ate%rdered 5ateRecieed @antity%rdered *tem!ost %rder0bTotal %rderTa7 %rderTotal!ost
E E 3 % 2 P M E
M E T *
*tem*5 *tem5escri+tion ReorderPoint@anity @antity%nand *temPrice