You are on page 1of 7

Concepts of Database Management, Sixth Edition Solutions 2-1

Chapter 2
The Relational Model 1:
Introduction, QBE, and Relational Algebra
Solutions
Ansers to Re!ie Questions
Note: Answers to odd-numbered reiew !uestions are found in Appendix D of the textboo"#
1# A relation is a two-dimensional table in which $1% the entries in the table are single-alued& $2% each column
has a distinct name& $'% all of the alues in a column are alues of the same attribute& $(% the order of the
columns is immaterial& $)% each row is distinct& and $*% the order of the rows is immaterial#
2# A relational database is a collection of relations#
'# An unnormali+ed relation is a structure that satisfies all the properties of a relation except the restriction
that entries must be single-alued# ,t is not a relation#
(# Attribute is another term for a column in a table#
)# ,n the shorthand representation, each table is listed, and after each table, all the columns of the table are
listed in parentheses# -rimar. "e.s are underlined#
Branch (BranchNum, BranchName, BranchLocation, NumEmployees)
Publisher (PublisherCode, PublisherName, City)
Author (AuthorNum, AuthorLast, AuthorFirst)
Book (BookCode, Title, PublisherCode, Type, Price, Paperback)
rote (BookCode, AuthorNum, !e"uenceNum)
#n$entory (BookCode, BranchNum, %n&and)
*# /o !ualif. a field name means to indicate the table to which it belongs b. preceding the field name with the
table name and a period# /o !ualif. the Street field in the Customer table, .ou would enter Customer#Street#
0# /he primar. "e. is the column or collection of columns that uni!uel. identifies a gien row# /he primar.
"e. of the 1ranch table is 1ranch2um# /he primar. "e. of the -ublisher table is -ublisherCode# /he
primar. "e. of the Author table is Author2um# /he primar. "e. of the 1oo" table is 1oo"Code# /he
primar. "e. of the 3rote table is the concatenation $combination% of 1oo"Code and Author2um# /he
primar. "e. of the ,nentor. table is the concatenation of 1oo"Code and 1ranch2um#
4# ,nclude the field in the design grid and ma"e sure the field5s Show chec" box contains a chec" mar"#
6# Enter the criteria in the Criteria row for the appropriate field name#
17# /o combine criteria with A2D, enter the conditions on the same Criteria row in the design grid# /o
combine criteria with 89, enter the conditions on different Criteria rows in the design grid#
11# /.pe the computation instead of a field name in the design grid# Alternatiel., .ou can enter the
computation in the :oom dialog box#
12# /o calculate functions, clic" the /otals button in the Show;<ide group on the =uer. /ools Design tab, and
then add one of the following functions to the /otal row for the column> Count, Sum, Ag $aerage%, Max
$largest alue%, Min $smallest alue%, StDe $standard deiation%, ?ar $ariance%, @irst, and Aast#
1'# ,ndicate the appropriate sort order $Ascending or Descending% in the Sort row of the design grid#
Concepts of Database Management, Sixth Edition Solutions 2-2
1(# 3hen sorting on more than one field in an Access !uer., the sort "e. to the left in the design grid is the
maBor "e. and the sort "e. to the right is the minor "e.# /he data is sorted on the maBor "e.# 3ithin those
rows with the same alue in the maBor "e., the data is sorted b. the minor "e.#
1)# ,nclude the field lists from both tables in the !uer. design# -roided the tables hae matching fields, a Boin
line will connect the tables# ,nclude the desired fields from either table in the design grid#
1*# Cse an update !uer. when .ou want to ma"e the same change to all rows satisf.ing some criteria#
10# Cse a delete !uer. when .ou want to delete all rows satisf.ing some criteria#
14# Cse a ma"e-table !uer. to sae the results of a !uer. as a table#
16# 9elational algebra is a theoretical wa. of manipulating a relational database# 9elational algebra includes
operations that act on existing tables to produce new tables, similar to the wa. the operations of addition
and subtraction act on numbers to produce new numbers in the mathematical algebra with which .ou are
familiar#
27# /he SEAEC/ command selects all rows satisf.ing some condition#
21# /he -98DEC/ command selects onl. the specified columns#
22# /he D8,2 command combines tables on matching columns#
2'# /he C2,82 command selects all rows that are in the first table, in the second table, or both#
2(# /he two tables must be union compatible& that is, the. must hae the same number of columns and the
columns must correspond#
2)# /he ,2/E9SEC/ command selects all rows that are in both tables#
2*# /he SC1/9AC/ command selects all rows that are in the first table, but not in the second table#
20# /he -98DCC/ command $mathematicall. called the Cartesian product% is the table obtained b.
concatenating eer. row in the first table with eer. row in the second table#
24# 3hen one table is diided b. a second table, the D,?,S,82 command produces a table containing all
alues in the first table that match all rows in the second table#
Ansers to "re#iere "roducts E$ercises: QBE
/he following answers indicate how to perform the specified tas" in Microsoft Access# /he process for other
database management s.stems would be different, although it should be similar# See the ,nstructor5s 9esource Eit
on CD-98M for a cop. of the -remiere -roducts database that contains the solutions to these exercises#
1# ,nclude the Customer2um and Customer2ame fields in the design grid# Do not include an. criteria#
2# Double-clic" the asteris" in the -art table field list to add all fields to the design grid# Do not enter an.
criteria#
'# ,nclude the Customer2um, Customer2ame, and 9ep2um fields in the design grid# Enter ') in the Criteria
row for the 9ep2um column# 9emoe the chec" mar" from the Show Chec" box in the 9ep2um column#
(# -lace the Customer2um, Customer2ame, CreditAimit, and 9ep2um fields in the design grid# Enter ') in
Criteria row for the 9ep2um column and 17777 in the Criteria row for the CreditAimit column# 9emoe
the chec" mar"s from the Show chec" boxes for the CreditAimit and 9ep2um columns#
)# -lace the Customer2um, Customer2ame, CreditAimit, and 9ep2um fields in the design grid# Enter ') in
Criteria row for the 9ep2um column and 17777 in the 8r row for the CreditAimit column# 9emoe the
chec" mar"s from the Show chec" boxes for the CreditAimit and 9ep2um columns#
*# ,nclude the field lists for the 8rders and Customer tables in the !uer. design# -lace the 8rder2um,
8rderDate, Customer2um, and Customer2ame columns in the design grid# Do not enter an. criteria#
Concepts of Database Management, Sixth Edition Solutions 2-'
0# ,nclude the field lists for the Customer and 9ep tables in the !uer. design# ,nclude the Customer2um and
Customer2ame fields from the Customer table# ,nclude the Aast2ame and @irst2ame fields from the 9ep
table# Enter -ere+ in the Criteria row for the Aast2ame column and Duan in the Criteria row for the
@irst2ame column# 9emoe the chec" mar"s from the Show chec" boxes for the Aast2ame and @irst2ame
columns#
4# -lace the Customer2um and CreditAimit fields in the design grid# ,nclude the /otal row# -lace the Count
function in the /otal row for the Customer2um column# Select 3here in the /otal row for the CreditAimit
column and enter 17777 in the Criteria row for the CreditAimit column#
6# -lace the 1alance and 9ep2um fields in the design grid# ,nclude the /otal row# ,n the 1alance column,
select the Sum function in the /otal row# ,n the 9ep2um column, select 3here in the /otal row and enter
') in the Criteria row#
17# -lace the -art2um, Description, and Class fields in the design grid# ,n the next column, enter the
computation for the 8n-<and?alue $8n<and F -rice%# /.pe <3 in the Criteria row for the Class column,
and remoe the chec" mar" from the Show chec" box in the Class column#
11# -lace all fields in the -art table in the design grid# Select Ascending in the Sort row for the Description
column#
12# -lace all fields in the -art table in the design grid# ,nclude the -art2um field a second time and remoe the
chec" mar" from its Show chec" box# Select Ascending in the Sort row for the Class column# Select
Ascending in the Sort row for the second -art2um column#
1'# ,nclude the /otal row# -lace the Class and 8n<and fields in the design grid# ,n the Class column, select the
Group 1. function in the /otal row# ,n the /otal row for the 8n<and column, select the Sum function#
1(# ,nclude the field list for the -art table in the !uer. design# -lace the -art2um, Description, Class, 8n<and,
3arehouse, and -rice fields in the design grid# Enter SG in the Criteria row for the Class column and
remoe the chec" mar" from the column5s Show Chec" box# Change the !uer. t.pe to Ma"e-/able !uer.,
and enter SportingGoods as the name of the table#
1)# ,nclude the field list for the SportingGoods table in the !uer. design and change the !uer. t.pe to Cpdate
!uer.# -lace the -art2um and Description fields in the design grid# Enter @itness G.m in the Cpdate /o
row for the Description column, and enter 1?7* as the criterion for the -art2um column#
1*# ,nclude the field list for the SportingGoods table in the !uer. design and change the !uer. t.pe to Delete
!uer.# -lace the -rice field in the design grid# Enter H1777 as the criterion for the -rice column#
Ansers to "re#iere "roducts E$ercises: Relational Algebra
1#
P'%(ECT 'ep %)E' ('epNum, LastName, FirstName) *#)#N* Ans+er
2#
!ELECT Part &E'E PartNum , -F./0- *#)#N* Ans+er
'#
(%#N %rders Customer &E'E %rders1CustomerNum , Customer1CustomerNum
*#)#N* Temp0
P'%(ECT Temp0 %)E' (%rderNum, %rder.ate, CustomerNum, CustomerName)
*#)#N* Ans+er
(#
(%#N %rders Customer &E'E %rders1CustomerNum , Customer1CustomerNum
*#)#N* Temp0
(%#N Temp0 'ep &E'E Temp01'epNum , 'ep1'epNum *#)#N* Temp/
!ELECT Temp/ &E'E 'ep1LastName , -2aiser- *#)#N* Temp3
P'%(ECT Temp3 %)E' (%rderNum, %rder.ate, CustomerNum, CustomerName)
*#)#N* Ans+er
Concepts of Database Management, Sixth Edition Solutions 2-(
)#
!ELECT %rders &E'E %rder.ate,-045/45/404- *#)#N* Temp0
P'%(ECT Temp0 %)E' (%rderNum, %rder.ate) *#)#N* Temp/
(%#N %rders Customer &E'E %rders1CustomerNum , Customer1CustomerNum
*#)#N* Temp3
!ELECT Temp3 &E'E 'epNum , -/4- *#)#N* Temp6
P'%(ECT Temp6 %)E' (%rderNum, %rder.ate) *#)#N* Temp7
8N#%N Temp/ #T& Temp7 *#)#N* Ans+er
*#
!ELECT %rders &E'E %rder.ate,-045/45/404- *#)#N* Temp0
P'%(ECT Temp0 %)E' (%rderNum, %rder.ate) *#)#N* Temp/
(%#N %rders Customer &E'E %rders1CustomerNum , Customer1CustomerNum
*#)#N* Temp3
!ELECT Temp3 &E'E 'epNum , -/4- *#)#N* Temp6
P'%(ECT Temp6 %)E' (%rderNum, %rder.ate) *#)#N* Temp7
#NTE'!ECT Temp/ #T& Temp7 *#)#N* Ans+er
0#
!ELECT %rders &E'E %rder.ate,-045/45/404- *#)#N* Temp0
P'%(ECT Temp0 %)E' (%rderNum, %rder.ate) *#)#N* Temp/
(%#N %rders Customer &E'E %rders1CustomerNum , Customer1CustomerNum
*#)#N* Temp3
!ELECT Temp3 &E'E 'epNum , -/4- *#)#N* Temp6
P'%(ECT Temp6 %)E' (%rderNum, %rder.ate) *#)#N* Temp7
!8BT'ACT Temp7 F'%9 Temp/ *#)#N* Ans+er
Ansers to %enr& Boo's Case
/he following answers indicate how to perform the specified tas" in Microsoft Access# /he process for other
database management s.stems would be different, although it should be similar# See the ,nstructor5s 9esource Eit
on CD-98M for a cop. of the <enr. 1oo"s database that contains the solutions to these exercises#
1# ,nclude the Author2um and AuthorAast fields in the design grid# Do not enter an. criteria#
2# Double-clic" the asteris" in the 1ranch field list to add all fields to the design grid# Do not enter an.
criteria#
'# ,nclude the -ublisher2ame and Cit. fields in the design grid# 9emoe the chec" mar" from the Show
chec" box in the Cit. column# /.pe 1oston in the Criteria row for the Cit. column#
(# ,nclude the -ublisher2ame and Cit. fields in the design grid# 9emoe the chec" mar" from the Show
chec" box in the Cit. column# /.pe IH1oston in the Criteria row for the Cit. column#
)# ,nclude the 1ranch2ame and 2umEmplo.ees fields in the design grid# 9emoe the chec" mar" from the
Show chec" box in the 2umEmplo.ees column# /.pe HJ6 in the Criteria row for the 2umEmplo.ees
column#
*# ,nclude the 1oo"Code, /itle, and /.pe fields in the design grid# 9emoe the chec" mar" from the Show
chec" box in the /.pe column# /.pe S@, in the Criteria row for the /.pe column#
0# ,nclude the 1oo"Code, /itle, /.pe, and -aperbac" fields in the design grid# 9emoe the chec" mar" from
the Show chec" box in the /.pe and -aperbac" columns# /.pe S@, in the Criteria row for the /.pe column#
/.pe either /rue or Kes in the Criteria row of the -aperbac" column#
4# ,nclude the 1oo"Code, /itle, -ublisherCode, and /.pe fields in the design grid# 9emoe the chec" mar"
from the Show chec" boxes in the -ublisherCode and /.pe columns# /.pe S@, in the Criteria row for the
/.pe column# /.pe -E in the 8r row of the -ublisherCode column#
Concepts of Database Management, Sixth Edition Solutions 2-)
6# ,nclude the 1oo"Code, /itle, and -rice fields in the design grid# /.pe H) A2D I17 in the Criteria row for
the -rice column#
17# ,nclude the 1oo"Code, /itle, /.pe, and -rice fields in the design grid# 9emoe the chec" mar" from the
Show chec" boxes in the /.pe and -rice columns# /.pe @,C in the Criteria row for the /.pe column# /.pe
I17 in the Criteria row for the -rice column#
11# ,nclude the 1oo"Code and /itle fields in the design grid# Enter the expression
Discounted-rice>7#4)FL-riceM in the first open column in the design grid#
12# ,nclude the 1oo"Code, /itle, and /.pe fields in the design grid# 9emoe the chec" mar" from the Show
chec" box in the /.pe column# /.pe S@, in the Criteria row for the /.pe column# /.pe <89 in 8r row for
the /.pe column# /.pe A9/ in the row below the 8r row for the /.pe column#
1'# ,nclude the 1oo"Code, /itle, and -ublisher fields in the design grid# ,nclude the /itle column a second time
and remoe the chec" mar" from its Show chec" box# Select Ascending in the Sort row for the
-ublisherCode column# Select Ascending in the Sort row for the second /itle column#
1(# ,nclude the /otal row# Add the 1oo"Code and /.pe fields to the design grid# Select the Count function in
the /otal row for the 1oo"Code column# Select 3here in the /otal row for the /.pe column# Enter S@, in
the Criteria row for the /.pe column#
1)# ,nclude the /otal row# Add the /.pe and -rice fields in the design grid# Ma"e sure the Group 1. operator
is selected in the /otal row for the /.pe column# Select the Ag function in the /otal row for the -rice
column#
1*# ,nclude the field lists for the 1oo" and -ublisher tables in the !uer. design# ,nclude the 1oo"Code and
/itle fields from the 1oo" table# ,nclude the -ublisherCode and -ublisher2ame fields from the -ublisher
table#
10# ,nclude the field lists for the 1oo" and -ublisher tables in the !uer. design# ,nclude the /itle and -rice
fields from the 1oo" table# ,nclude the -ublisher2ame field from the -ublisher table and remoe the chec"
mar" from the Show chec" box in the -ublisher2ame column# /.pe /aunton -ress in the Criteria row for
the -ublisher2ame column#
14# ,nclude the field lists for the 1oo" and -ublisher tables in the !uer. design# ,nclude the 1oo"Code, /itle,
and -rice fields from the 1oo" table# 9emoe the chec" mar" from the Show chec" box in the -rice
column# ,nclude the -ublisher2ame field from the -ublisher table and remoe the chec" mar" from the
Show chec" box in the -ublisher2ame column# /.pe -utnam -ublishing Group in the Criteria row for the
-ublisher2ame column and enter H1) in the Criteria row for the -rice column#
16# ,nclude the 1oo"Code, /itle, -ublisherCode, /.pe, and -rice columns in the design grid# Enter @,C in the
Criteria row for the /.pe column and remoe the chec" mar" from the column5s Show Chec" box# Change
the !uer. t.pe to Ma"e-/able !uer., and enter @iction as the name of the table#
27# ,nclude the field list for the @iction table in the design grid and change the !uer. t.pe to Cpdate !uer.#
,nclude the -rice field in the design grid, enter 1(#)7 in the Cpdate /o row of the -rice column, and enter
1(#77 in the Criteria row for the -rice column#
21# ,nclude the field list for the @iction table in the !uer. design and change the !uer. t.pe to Delete !uer.#
,nclude the -ublisherCode field in the design grid and enter ?1 in the Criteria row for the -ublisherCode
column#
Ansers to Ale$a#ara Marina (roup Case
/he following answers indicate how to perform the specified tas" in Microsoft Access# /he process for other
database management s.stems would be different, although it should be similar# See the ,nstructor5s 9esource Eit
on CD-98M for a cop. of the Alexamara database that contains the solutions to these exercises#
1# ,nclude the 8wner2um, Aast2ame, and @irst2ame fields in the design grid# Do not enter an. criteria#
Concepts of Database Management, Sixth Edition Solutions 2-*
2# Double-clic" the asteris" in the Marina field list to add all fields to the design grid# Do not enter an.
criteria#
'# ,nclude the Aast2ame, @irst2ame, and Cit. fields from the 8wner table in the design grid# 9emoe the
chec" mar" from the Show chec" box for the Cit. column# Enter 1owton in the Criteria row for the Cit.
column#
(# ,nclude the Aast2ame, @irst2ame, and Cit. fields from the 8wner table in the design grid# 9emoe the
chec" mar" from the Show chec" box for the Cit. column# Enter IH 1owton in the Criteria row for the
Cit. column#
)# ,nclude the Marina2um, Slip2um, and Aength fields from the MarinaSlip table in the design grid# 9emoe
the chec" mar" from the Show chec" box for the Aength column# Enter IJ'7 in the Criteria row for the
Aength column#
*# ,nclude the Marina2um, Slip2um, and 1oat/.pe fields from the MarinaSlip table in the design grid#
9emoe the chec" mar" from the Show chec" box for the 1oat/.pe column# Enter Dolphin 24 in the
Criteria row for the 1oat/.pe column#
0# ,nclude the Slip2um, Marina2um, and 1oat/.pe fields from the MarinaSlip table in the design grid#
9emoe the chec" mar"s from the Show chec" boxes for the Marina2um and 1oat/.pe column# Enter 1 in
the Criteria row for the Marin2um column# Enter Dolphin 24 in the Criteria row for the 1oat/.pe column#
4# ,nclude the 1oat2ame and Aength fields from the MarinaSlip table in the design grid# 9emoe the chec"
mar" from the Show chec" box for the Aength column# Enter HJ2) A2D IJ'7 in the Criteria row for the
Aength column#
6# ,nclude the Slip2um, Marina2um, and 9ental@ee fields from the MarinaSlip table in the design grid#
9emoe the chec" mar" from the Show chec" boxes for the Marina2um and 9ental@ee columns# /.pe 1 in
the Criteria row for the Marina2um column# /.pe I'777 in the Criteria row for the 9ental@ee column#
17# ,nclude the Slip,D, Categor.2um, and Est<ours fields from the Serice9e!uest table in the design grid#
Enter the expression EstimatedCost>*7FLEst<oursM in the first open column in the design grid#
11# ,nclude the Marina2um, Slip2um, and 1oat/.pe fields from the MarinaSlip table in the design grid#
9emoe the chec" mar" from the Show chec" box for the 1oat/.pe column# Enter Sprite (777 in the
Criteria row for the /.pe column# /.pe Sprite '777 in the 8r row for the /.pe column# /.pe 9a. (72) in
the row below the 8r row in the /.pe column#
12# ,nclude the Marina2um, Slip2um, and 1oat2ame fields from the MarinaSlip table in the design grid#
Select Ascending in the Sort row for the Marina2um and 1oat2ame columns#
1'# Add the Marina2um and 1oat/.pe fields from the MarinaSlip table in the design grid# ,nclude the /otal
row# Select the Count function in the /otal row for the Marina2um column# Select 3here in the /otal row
for the 1oat/.pe column# Enter Dolphin 2) in the Criteria row for the 1oat/.pe column#
1(# Add the Aength and 9ental@ee fields from the MarinaSlip table in the design grid# ,nclude the /otal row#
Ma"e sure the Group 1. operator is selected in the /otal row for the Aength column# Select the Sum
function in the /otal row for the 9ental@ee column#
1)# ,nclude the field lists for the MarinaSlip and 8wner tables in the !uer. design# ,nclude the Marina2um,
Slip2um, and 1oat2ame fields from the MarinaSlip table# ,nclude the 8wner2um, @irst2ame, and
Aast2ame fields from the 8wner table#
1*# ,nclude the field lists for the Serice9e!uest and SericeCategor. tables in the !uer. design# ,nclude the
Slip,D, Description, and Status fields from the Serice9e!uest table# ,nclude the Categor.Description field
from the Categor. table and remoe the chec" mar" from the Show chec" box for the Categor.Description
column# Enter 9outine engine maintenance in the Criteria row for the Categor.Description column#
10# ,nclude the field lists for the Serice9e!uest, MarinaSlip, SericeCategor., and 8wner tables in the !uer.
design# ,nclude the Slip,D field from the Serice9e!uest table# ,nclude the Marina2um and Slip2um fields
from the MarinaSlip table# ,nclude the Est<ours and Spent<ours fields from the Serice9e!uest table#
,nclude the Categor.Description field from the SericeCategor. table and remoe the chec" mar" from the
Concepts of Database Management, Sixth Edition Solutions 2-0
Show chec" box for the Categor.Description column# /.pe 9outine engine maintenance in the Criteria row
for the Categor.Description column# ,nclude the 8wner2um and Aast2ame fields from the 8wner table#
14# ,nclude the field list for the MarinaSlip table in the !uer. design# ,nclude the Marina2um, Slip2um,
9ental@ee, 1oat2ame, 8wner2um, and Aength columns in the design grid# Enter (7 in the Criteria rpw fpr
the Aength column# 9emoe the chec" mar" from the Show chec" box for the Aength column# Change the
!uer. t.pe to Ma"e-/able !uer., and enter AargeSlip as the name of the table#
16# ,nclude the field list for the AargeSlip table in the !uer. design and change the !uer. t.pe to Cpdate !uer.#
,nclude the 9ental@ee field in the design grid, enter '677 in the Cpdate /o row for the 9ental@ee column,
and enter '477 in the Criteria row for the 9ental@ee column#
27# ,nclude the field list for the AargeSlip table in the !uer. design and change the !uer. t.pe to Delete !uer.#
,nclude the 9ental@ee field in the design grid and enter '*77 in the Criteria row for the 9ental@ee column#

You might also like