You are on page 1of 2

CSEC INFORMATION TECHNOLOGY

Database Management Activity Sheet 2 - Queries


Read carefully then attempt all instructions in the order given.
Rename the LIBRARY database on the wii !database management "age# to inc$ude your initia$s%
a% &"en the LIBRARY database and amend to inc$ude the 'o$$owing(
BOOK_COD
E TYE !"T#OR BOOK_$!%E
)*+,,- hea$th Dr% &.wa$d Merri$$ Your S"hincter /eeds You
B012- se$'-he$" 3%Morasse4 5hD
6hen -rue$ Re$ationshi"s )o$d
You Bac
72,,- 8unior 9eorge 3inneas :he -at And :he Rat
72,0- 8unior Su.anne Mi$$er
2; Ste"s 3rom :he Basement
Monster
B21+- se$'-he$" Robert < the Ra.or= 3ran$in &ver 1, And -on'used
b% Modi'y the database structure to inc$ude an additiona$ tab$e ca$$ed L&A/S% :his wi$$ be
used to store detai$s on the "erson borrowing the boo4 the date it was $oaned and so on%
Set u" the tab$e to ho$d this data "$us + more records o' your choosing(
BOOK_CODE BORRO&ER_$!%E B_CODE B_D!TE
O'ERD"
E
)*+,,- :%>ng$ish LIB,,2 Se"t 2?4 2,2, /
);0,- 7%Mende. LIB,,2 Se"t 2?4 2,2, Y
A22,- :%:urner LIB,,? Se"t 2?4 2,2, Y
72,0- R%-ami$$a LIB,,1 Se"t 214 2,2, /
);0,- :%>ng$ish LIB,,2 &ct 24 2,2, Y
c% Set the most a""ro"riate 'ie$d as "rimary ey% Amend the re$ationshi"s as needed%
d% @se a Auery !)MBAuery# to show names o' authors and boos o' hea$th or mystery boos%
e% @se another Auery to show the Borrowers4 3ine4 Borrow Date and Boonames o' a$$
overdue boos% -a$$ it &verdueBAuery%
'% @se a Auery to show the names4 authors and boo codes o' boos in the $ibrary4 sorted by
ty"es% -a$$ it SortBAuery%
g% Mae a co"y o' the L&A/S tab$e and ca$$ it L&A/S2% De$ete the records concerning
7%Mende. who has cance$$ed her membershi" in the $ibrary%
Calculated (ields
)ow do you get Access to store the resu$t o' a ca$cu$ationC
3or eDam"$e4 i' you have 'ie$ds named Quantity and UnitPrice4 how do you get Access
to write Quantity * UnitPrice to another 'ie$d in that tab$e ca$$ed AmountC You don=t% You
"ut the ca$cu$ated 'ie$d in a Auery4 not in the origina$ tab$e%
@n$ie s"readsheets4 where ca$cu$ations in a co$umn are "art o' $i'e4 in a database tab$e4
you never store a va$ue that is de"endent on other 'ie$ds%
So4 how do you get the ca$cu$ated 'ie$d i' you do not store it in a tab$eC @se a Auery(
2% -reate a Auery based on your tab$e%
1
2% :y"e your eD"ression into the 3ie$d row o' the Auery design grid(
Amount: [Table1]![Quantity] * [Table1]![UnitPrice]
:his creates a 'ie$d in the Auery named Amount% Any 'orm or re"ort based on this Auery
treats the ca$cu$ated 'ie$d $ie any other4 so you can easi$y sum the resu$ts% It is sim"$e4
e''icient4 and 'oo$"roo'%
S&@R->( htt"(EEa$$enbrowne%comEcasu-21%htm$
h% @se a Auery to show what an increase in the 'ines on a$$ boos eDce"t 8unior ty"e to ?+F
wou$d $oo $ie !the symbo$ GH means /&: >Q@AL#% /ame it IncrBAuery
i% -reate an additiona$ 'ie$d in IncrBAuery to show the amount each "erson owes in 'ines a'ter
the 'ine increase !remember that a Auery can "u$$ data 'rom another Auery as we$$ as 'rom
tab$es#%
Recommended reading(
htt"(EEwww%webo''ice%comEweb-databaseEca$cu$ated-'ie$ds%htm$
htt"(EEo''ice%microso't%comEen-caEaccess-he$"Eabout-ca$cu$ations-in-a-Auery-mdb-
)5,,+200,2*%as"D
htt"(EE'ontstu''%comEaccessEacctut,2%htm
rint the results and )*+ vie,s of all -ueries .you can e/port them to a single &ord file0.
1nclude a cover page ,ith your name and option and the title 2!CT1'1TY )#EET34. )u5mit
for grading.
2

You might also like