You are on page 1of 75

Answers

to odd numbered exercise questions

Terry Halpin and Tony Morgan


Neumont University

Answers in this document are supplied for odd numbered exercise questions, as well as a
few even numbered questions. Answers to the other exercise questions are available as a
separate document to class instructors using the book as a set text.

Exercise 2.1
1. (a) C (b) A (c) B

Exercise 2.2
1. (a) Ensure database updates are consistent with the conceptual schema. Answer queries about
the UoD.
(b) Declarations of: fact types; constraints; derivation rules.
(c) False. With compound transactions, only the collective effect of all the elementary updates
is considered.
3. (a) accepted
(b) rejected. C1 violated. Sue must be enrolled in a degree.
(c) accepted
(d) rejected. C1 violated. Fred may not enroll in two degrees.
(e) rejected. Fact type not recognized.
(f) single, married, widowed, divorced
(g) accepted
(h) rejected. C2 violated.
(i) accepted.
(j) accepted.
(k) rejected. C4 violated. Transition single to divorced illegal.
(l) No
(m) Fred, Bob
(n) Sue
(o) rejected. Fact type not recognized. -- Such information would typically be derived
Final state of database: Student ‘Fred’ is enrolled in Degree ‘BSc’.
Student ‘Sue’ is enrolled in Degree ‘MA’.
Student ‘Bob’ is enrolled in Degree ‘BSc’.
Student ‘Bob’ has MaritalState ‘single’.
Student ‘Sue’ has MaritalState ‘married’.

1
Information Modeling and Relational Databases: Answers (odd)–2

5. (a) begin
add: Employee ‘Adams’ works for Department ‘Health’
add: Employee ‘Adams’ speaks Language ‘English’
end
begin
add: Employee ‘Brown’ works for Department ‘Health’
add: Employee ‘Brown’ speaks Language ‘English’
end
Brown’s data may be entered first. Within a compound transaction the order is irrelevant.
(b) (i) Employee ‘Adams’ works for Department ‘Health’. -- language missing
(ii) Employee ‘Adams’ works for Department ‘Health’.
Employee ‘Adams’ speaks Language ‘English’.
Employee ‘Adams’ works for Department ‘Education’. -- cannot work for 2 depts

Exercise 3.3
1. (a), (f), (j)
3−4. These questions reveal that columns with the same name need not have the same meaning.
In the absence of helpful table names, we make an educated guess. For example:
3. Athlete (.name) ‘Jones EM’ has height of Length (cm:) 166.
aliter: Athlete (.name) ‘Jones EM’ has Height 166 (cm: Length).
4. Athlete (.name) ‘Jones EM’ pole vaults a height of Length (cm:) 400.
aliter: Athlete (.name) ‘Jones EM’ pole vaults Height 400 (cm: Length).
5. The uniqueness of person entries suggests that each row contains two elementary facts. For
example, the top row may be verbalized as:
Person (.name) ‘Jones EM’ has height of Length (cm:) 166.
Person (.name) ‘Jones EM’ was born in Year (CE) 1955.
However, this is open to interpretation, as the population might not be significant (only a domain
expert can know for sure what is intended). So it is still possible that each row contains just a
ternary, elementary fact, e.g.,
Person (.name) ‘Jones EM’ had a height of Length (cm:) 166 in Year (CE) 1995.
7. Person (.surname) ‘Codd’ is an internal member of Panel (.name) ‘Databases’.
Person (.surname) ‘Ienshtein’ is an external member of Panel (.name) ‘Databases’.
9. For all relevant answers, we use “firstname” to mean “first given name” (to avoid confusion with
languages such as Japanese where the first name listed is normally the family name). Such a
definition or description may be noted in an ORM modeling tool.
Person (.firstname) ‘Ann’ is a parent of Person (.firstname) ‘Colin’.
Person (.firstname) ‘Ann’ is a parent of Person (.firstname) ‘David’.
Person (.firstname) ‘Ann’ is a parent of Person (.firstname) ‘Eve’.
Person (.firstname) ‘Bill’ is a parent of Person (.firstname) ‘Colin’.
Person (.firstname) ‘Bill’ is a parent of Person (.firstname) ‘David’.
Person (.firstname) ‘Bill’ is a parent of Person (.firstname) ‘Eve’.
11. The Fruit named ‘Apple’ is harvested in the Country named ‘Australia’ in the Month named
‘June’. etc.
Information Modeling and Relational Databases: Answers (odd)–3

Exercise 3.4
1. (a) Reference schemes: Person (.firstname).
Facts: Person ‘Fred’ is male. Person ‘Ann’ is female.

(b) *$2-,3"
!"#$%&
'()*#$+&,-".
*$2)"-,3"

(c) Reference schemes: Person (.firstname); Gender (.name)


Facts: Person ‘Fred’ has Gender ‘male’. Person ‘Ann’ has Gender ‘female’.

(d)
!"#$%& 0"&1"#
'()*#$+&,-". '(&,-".
/,$

3. Only the schema diagrams (two of six possible versions based on reading order) are shown here.
You should also verbalize and populate.

6+"- 78,&+*+9
'(&,-". '(&#.
4"+,*3"# 78,&+*+9 4"+,*3"# 6+"-
'(&,-". '(&#. '(&,-". '(&,-".
52$%31252*&2((( 52$%31252%)2(((

If you wish to think of Quantity as a pure number, then you may verbalize and model it as a
value type as shown below. Some ORM modelers treat this as an error, since they view even pure
numbers (as distinct from numerals) as entities, not values. So whether this is allowed or not
depends on the precise definition of what a value is. For mapping purposes, it makes so
difference, so we allow this relaxation.

6+"-
'(&,-".

4"+,*3"#
78,&+*+9
'(&,-".
52$%31252*&2(((

4. This schema is equivalent to the previous ones,


4"+,*3"#
which may be used again instead. Verbalization and '(&,-".
population are omitted here.
6+"- 78,&+*+9
'(&,-". '(&#.
52:,$2$%312;9252*&2(((

-""+$2%&
?""@1,9
5. '(>%1".
-""+$2*&
4%%- <8+"0#%8=
'(&#. '(>%1".
-""+$2,+
A%8#B3%+
'(>%1".
Information Modeling and Relational Databases: Answers (odd)–4

7.
/,$
!,$$:%#1

,==#%D"1 /,$
C"-;"# C%+*%&
C%+*%&<"F+
'(&#. '(&#.

#"E">+"1

8. (a) Illegal. Objects must play a role. Directly connecting object types is forbidden.
(b) Illegal. A role can be played by at most one object type.
(c) Illegal. Inside role has no object type.
(d) OK. For example: Person has Gender; Person was born in Country.
(e) Illegal. A role cannot be played by more than one object type.
(f) OK. For example: Person introduces Person to Person.
(g) OK, e.g.: Company employs Person; Company buys Computer; Person uses Computer.
(h) OK, e.g.: Person gives Present to Person on Date.
(i) Illegal. Object types should not be included in the nesting.
(j) OK, e.g.: Person is a parent of Person; Person has IQ.
(k) OK, e.g.: Person ordered Product: objectify as “Order”.
Order was issued on Date. Order was paid on Date.
(l) Illegal. An extended form of the error in (e).
9. Here is one solution that restricts the valuation date to the start of a month. A restriction to
specific non-US currencies (e.g. AUD and XEU) may be added as a value constraint (see
Chapter 6).

C%&+/
'9-.

J%&IBKG8##"&>9 C%&"9L-%8&+
'(>%1". 'IBHM.

52,+2$+,#+2%)252:,$2:%#+/22(((
!"#$%&'(")&*+",

Here is another solution that allows any currency for the first role (USD would then yield an
exchange value of 1) and any date for the valuation. It also avoids using USD as the standard
monetary unit. As you can see, there can be many correct solutions, so long as the domain
experts agree on how the terms used are to be interpreted.

H,+"
'9-1.

G8##"&>9 IBHD,38"
'(>%1". '(&#.
52%&252/,122(((
Information Modeling and Relational Databases: Answers (odd)–5

Exercise 3.5
*$21*$+#*;8+"12;9
1. N1*$+#*;8+%#O
B%)+:,#" G%-=,&9
'(&,-". '(&,-".

*$2$%312;9 N#"+,*3"#O
This solution assumes that distributors and retailers are companies. It also uses “sold” in the
sense of retailed (e.g., rather than wholesaled).

3. "-=3%9$2P2:%#@$2)%#
Q-=3%9""
'(&#.
N"-=3%9""O
N&#B+,))O /,$2,2;81R"+2%) /,$2,2$,3,#92%)
H"=,#+-"&+
J#B+,))
'(&,-". N$,3,#9O
/,$2!

C%&"9L-%8&+
'IBHM.
/,$2+%+,32$,3,#92%)2!
!"#$%"&'()2H"=,#+-"&+S N+%+,3B,3,#9O
222222&#B+,))2T2($*+,'"-=3%9"".(
!"#$%"&'()2H"=,#+-"&+S
222222+%+,3B,3,#92T2-*.'$,3,#92$/2"-=3%9"".(

Note: “employee.salary” may be used instead of “salary of employee” At the time of writing, the
NORMA tool is being extended to automatically generate implicit role names using object type
names (where the object type plays no other role in the relevant fact type) and concatenated
names obtained from hyphen binding. For example, using unit-based reference mode support
(where the USD unit is based on the Money dimension), the following alternative solution is
then allowed without explicitly adding role names.

"-=3%9$2P2:%#@$2)%#
Q-=3%9""
J#B+,)) '(&#.
/,$2!

V81R"+ H"=,#+-"&+ /,$


'IBHM. '(&,-".
/,$
/,$2+%+,3U2!
!"#$%"&'()2H"=,#+-"&+S B,3,#9
'IBHM.
222222&#B+,))2T2($*+,'"-=3%9"".(
!"#$%"&'()2H"=,#+-"&+S
222222+%+,3B,3,#92T2-*.'$,3,#92$/2"-=3%9"".(

5.
0"&1"# !"#$%& H"=,#+-"&+
'(>%1". '(&,-". '(&,-".
*$2%)2P2/,$ :%#@$2)%#

!"#$%&' -"./0'12/1&13"4&*"1"45*06""12'17"5&.84"'89
-"./0'12/1&14&*"1"45*06""12'17"5&.84"'8
Information Modeling and Relational Databases: Answers (odd)–6

7. /,$ G,=,>*+9
'CVM.
N>,=,>*+9O
:,$2*&+#%18>"12*&
G%$+!"#CV C"1*8- W",#
'IBHM. '(&,-". 'GQ.
/,$2!
N>%$+!"#CVO
/,$
H*$@!#*>"
!"#$%"&'()2C"1*8-S 'IBHM.
N1*$@!#*>"O
222222>%$+!"#CV2T21*$@!#*>"P>,=,>*+9(

Note: The role names shown above may be assumed once NORMA supports implicit role
names. Where relevant, later answers will typically omit implicit role names.

Exercise 4.2
1. Uniqueness constraints apply to: (a) B column; (b) AB combination; (c) A column and B column;
(d) A column.
3. Uniqueness constraints apply to: (a) each role (implied); (b) left role; (c) 3.3.3 role of Athlete,
3.3.4 role of Athlete, 3.3.5 each role of Person, 3.3.6 combination of Person and Year roles, 3.3.7
both fact types are many:many (population is not significant), 3.3.8 combination of Student and
Course roles, 3.3.9 many:many, 3.3.10 both fact types are many:many; (d) each of the three roles
of TuteGroup (later we see how to add external uniqueness constraints, e.g. the combination of
Room, Day and Hour is probably unique); (e) each role of Project, and the birth and salary roles
of Person; (f) each role of Person, and the budget role of Department.

Exercise 4.3

1. (a) AB, AC (b) AB, AC, BC (c) ABC (d) AC

3. (a)
/,12+%+,3U2!
W",#
'GQ.

V#,&>/ !#%)*+
'>*+9&,-". 'IBHM.
52*&252-,1"2(((

!"#$%"&'()2W",#S
2222222+%+,3!#%)*+2T2-*.'=#%)*+.(

(b)
XV#,&>/W",#Y
/,12+%+,3U2!
V#,&>/ W",#
'>*+9&,-". 'GQ.
%="#,+"12*&

!#%)*+
'IBHM.
-,1"
!"#$%"&'()2W",#S
2222222+%+,3!#%)*+2T2-*.';#,&>/W",#(=#%)*+.(

Note: “profit of branchyear” may be used instead of “branchYear.profit”.


Information Modeling and Relational Databases: Answers (odd)–7

Exercise 4.4

1. (a)
*$2+,8R/+2;9
[">+8#"#
XB8;E">+Z))"#*&RY '(*&*+*,3$.

G#"1*+ B8;E">+ B"-"$+"#


'(=%*&+$. '(>%1". '(&#.
/,$ *$2%))"#"12*&

J#B+81"&+$
/,$2"&#%33-"&+2%)

(b)
H8#,+*%&
'/M.
X!#%E">+?%#@Y /,1

Q-=3%9"" !#%E">+
'(&#. '(&#.
:%#@"12%&

QF="&$"$
'IBHM.
*&>8##"1

3. *$2%)
G,#C%1"3
'(&,-".
*$2%) 5
4"+,*3!#*>" G,# G%3%# %)25
'IBHM. '\6J. '(&,-". *&25
/,$
$%31
W",# *&2(((
'GQ.
:,$2-,1"2*&
78,&+*+9
:%2/1/$%"4&14&;"/1'01&88"4581801."$0.<
%2/80.61&=0+81/5"$232$1$&./130.4".*612'1/80$;>

Exercise 4.5

1. (a), (b), (d)

3. Since each executive has only one home phone, this information may be split off without
information loss. Hence the proposed ternary is compound, and must be split into two binaries,
as shown below.

/,$2:%#@U

QF">8+*D"
!/%&"J#
'(&,-".

/,$2/%-"U
Information Modeling and Relational Databases: Answers (odd)–8

5.
G%8&+#9
'(>%1".

C%D*" B,3"$["D"3
'(&,-". '(&,-".

52"F=%#+"12)#%-252+%252,>/*"D"12(((

This is unacceptable, since it cannot store the data in the final row. We must be able to store
facts about movie origins without knowing their export figures. The quaternary should be split,
as shown below:

%#*R*&,+"12*&

C%D*" G%8&+#9
'(&,-". '(>%1".

B,3"$["D"3
'(&,-".
52"F=%#+"12+%252,>/*"D"12(((

Exercise 4.6

1. (a) Constraints on AC, BC.

(b) Projections: Join:


a1 c1 b1 c1 a1 b1 c1
a1 c2 b1 c2 a1 b2 c1 × so unsplittable
a2 c1 b2 c1 etc. .. ..
a2 c2 b2 c2

(c) AB projection:a1 b1 BC projection as in (b)


a2 b2

The join gives the original table. So, assuming significant data, it is splittable in this way.

(d)
L V G

Exercise 5.2

1. /,$2>%,32#"$"#D"$2%)

G%8&+#9 C,$$
'(&,-". '0+M.

/,$2%*32#"$"#D"$2%)
Information Modeling and Relational Databases: Answers (odd)–9

3.
$>%#"1
J#]$
XG#*>@"+!3,9Y

G%8&+#9 W",#
'(&,-". 'GQ.

=3,9"12>#*>@"+2*&
J#^$
$>%#"1

J#V%8&1,#*"$ !"#$%"&'()2G#*>@"+!3,9S
$>%#"12! 222222&#V%8&1,#*"$2T2&#]$2_2&#^$(

Exercise 5.3

1. (a) *$2*&
B+#""+
'(&,-".
?,#"/%8$"
[%+J#
/,$

(b)1 Refine Street: *$2*&


B8;8#;
*$2*&
'(&,-".
B+#""+
?,#"/%8$" B+#""+J,-"
[%+J# /,$
/,$

*$2*&
G*+9
(c)1 Refine Suburb: *$2*&
'(&,-".
*$2*& B8;8#;
B+#""+ B8;8#;J,-"
?,#"/%8$" B+#""+J,-" /,$

[%+J# /,$
/,$
*$2*&
G%8&+#9
(d)1 Refine City: *$2*&
'(&,-".
*$2*& G*+9
*$2*& B8;8#; G*+9J,-"
B+#""+ B8;8#;J,-" /,$
?,#"/%8$" B+#""+J,-" /,$

[%+J# /,$
/,$

*$2%&
!3,&"+
(e)1 Refine Country *$2*&
'(&,-".
*$2*& G%8&+#9
*$2*& G*+9 G%8&+#9J,-"
*$2*& B8;8#; G*+9J,-" /,$
B+#""+ /,$
B8;8#;J,-"
?,#"/%8$" B+#""+J,-" /,$

[%+J# /,$
/,$
Information Modeling and Relational Databases: Answers (odd)–10

3. (a) /,$2FU

!%*&+
G%%#1*&,+"
'(3"++"#.

/,$29U

(b)
52*$252&%#+/2%)2+/"2>,+/"1#,3

!,#@*&RB+,+*%& J#V3%>@$

52*$252",$+2%)2+/"2>,+/"1#,3

Note: This schema fragment is just a reference scheme for parking stations. We may now
add facts about them (e.g. hours open). South and West coordinates have negative values.

5.
>,&2;"&>/2=#"$$ >,&2;"&>/2=#"$$
C,$$ C,$$
'@RM. '@RM2C,$$.
C"-;"# C"-;"#
'(&#. '(&#.
V%19C,$$ V%19C,$$
'3;M.! '3;M2C,$$.!
/,$ /,$
!2`23;2T2a(]b]2@R !2`23;2T2a(]b]2@R

Note: This schema uses kg as the standard unit of mass. The bench press fact type assumes
earth surface gravity. If you choose lb as the standard unit, the conversion rule is * 1 kg =
2.205 lb. If you choose the term “weight”, either add definitions to indicate that strictly you
mean mass, or change the units to lb wt and kg wt.

7. :,$2+,@"&2;9
Q-=3%9""
Q-=3%9""J,-"
'BBJ.
/,$

<"$+ H,+"
'(&#. '-19.
:,$2=,$$"12! :,$2+,@"&2%&

<"$+B>%#"
#"$83+"12*&

!2<"$+2:,$2=,$$"120//
2222222<"$+2#"$83+"12*&2'2<"$+B>%#"2cT2da(
Note: This derivation rule is neater in relational style, as shown above, but here is one way to
specify it in attribute style:
!"#$%"&'()2<"$+S
222222:,$2=,$$"12T2,%*&20//"+"$+B>%#"2cT2da(
Information Modeling and Relational Databases: Answers (odd)–11

Exercise 5.4

1. *$2%)2P2/,$
<%8#H"$>#*=+*%& /,$2P2*$2%)
B*+"J,-"
/,$2>/*31U B+%=J#
/,$2P2*$2%)
e,#" <%8# B*+" e,>*3*+9
e,>*3*+9J,-"
'LIHM. /,$2,183+U '(&#. '(>%1". '(>%1".
/,$
52,+252D*$*+$2(((
/,$
H8#,+*%& 1"=,#+$2,+
'/M. N1"=,#+8#"<*-"O
*$2%)
$"#D"$2,2$&,>@ <*-"Z)H,9
'/-.
<%8#B/*)+
$"#D"$2,2-,*&2-",3 '(>%1". N#"+8#&<*-"O
#"+8#&$2,+2!

:,$2;%#&2%& $8==%#+$
H,+" /,$
'9-1. [,&R8,R"
'(&,-".
0"&1"# H#*D"#
'(>%1". '(&#.
/,$ *$2)38"&+2*&

H#*D"#J,-" H#*D"#[*>"&$"
/,$ '(&#.
/,$2P2*$2%)

!"#$%"&'()2<%8#B/*)+S
2222222#"+8#&<*-"2T21"=,#+8#"<*-"2_2+%8#(18#,+*%&(

X<%8#B+%=Y
2.
<%8#
B+%=J#
'(&#. $+%=$2,+
D*$*+$
B*+"
'(>%1".

Exercise 5.5 :%#@$2*&2!

1.
?%#@"#
J,-"
/,$2P2*$2%)
?%#@"# !G 4%%-
'(*&*+*,3$. '(&#. '(&#.
8$"$ *$2*&
*$2"F="#+2*&

5 *$2*&$+,33"12%&
+,3@$2,;%8+
5 [,&R8,R" [,&R8,R"<9="
)%# '(&,-". '(&,-".
((( *$2%)
N+%+,3H*$>8$$*%&<*-"O !"?%#@"#2:%#@$2*&24%%-20//
H8#,+*%&
'/M. 22222222?%#@"#28$"$2-$.&2!G2,)',2*$2*&24%%-(
*$21*$>8$$"12)%#2+%+,3U2! !"#$%"&'()2[,&R8,R"<9="S
222222222+%+,3H*$>8$$*%&<*-"2T2-*.'3,&R8,R"(18#,+*%&.(
Information Modeling and Relational Databases: Answers (odd)–12

2.
:%#@$2)%#2P2"-=3%9$
H"=,#+-"&+
'(>%1".

[">+8#"# *$
'($8#&,-". 3%>,+"1
*&

V8*31*&R
'(&#.
:%#@$2*&

None of the fact types is (fully) derivable, so an assserted fact type is needed for each.
The department location fact type is semiderivable if the following if-rule (not iff) holds:
+
Department is located in Building if
Department employs some Lecturer who works in Building.

3. :%#@$2)%#2P"-=3%9$
H"=,#+-"&+
'>%1".

[">+8#"# *$
'$8#&,-". 3%>,+"1
*&2!

V8*31*&R
'&#.
:%#@$2*&

UU2L$$8-*&R2",>/21"=,#+-"&+2"-=3%9$23">+8#"#$2*&2,332*+$2;8*31*&R$
!2H"=,#+-"&+2*$23%>,+"12*&2V8*31*&R20//
H"=,#+-"&+2"-=3%9$2-$.&2[">+8#"#21)$2:%#@$2*&2V8*31*&R(

This solution assumes that for each department, we must record at least one lecturer for
each of the department’s buildings. If this is not true, then none of the fact types is fully
derivable, and our solution is the same as for Question 2 except for the extra mandatory
constraint.

Exercise 6.3

1.
G/,#R"B*R&
fg3"=+%&gS '($9-;%3. fg_gS2gUgS2gagh
e,-*39 !,#+*>3" /,$
2g-"$%&gS
'(&,-". '(&,-".
2g;,#9%&gh *&>381"$2P2*$2*& C,$$
',-8M. fa((iaaah
/,$
Information Modeling and Relational Databases: Answers (odd)–13

3. /,$ :,$2*$$8"12%&
G8$+%-"#J,-" :,$2*$$8"12+%
G8$+%-"# 6&D%*>" H,+"
'(&#. '(&#. '1-9.
L11#"$$ :,$2=,*12%&
X[*&"6+"-Y
/,$
/,$ /,$
!/%&"J# I&*+!#*>"
/,$ *$23*$+"12%& 'LIHM.

78,&+*+9
/,$2$+%>@U /,$
[*$+!#*>"
'LIHM.
6+"-
'(>%1".
G,+"R%#9
6+"-<*+3"
'(>%1".
/,$ *$2*&
!2#$%"&'()2[*&"6+"-S fjHVkS2jBBkS2j?!kh
$8;+%+,32T2l8,&+*+92m28&*+!#*>"(

!"#$%"&'()26&D%*>"S
+%+,32T2-*.'$8;+%+,32$/23*&"6+"-.(

Note: The derived fact types !"#$%&$'( )*+( ,-.&/&*0123456 and %#7/"8$( )*+( 9/&*0123456 may be
displayed on the diagram if desired.

5. (a)
6+"-
'(>%1".

B8==3*"#
78,&+*+9
'(&,-".
52$8==3*"1252*&2(((

(b) (i)
X[*&"6+"-Y

6&D%*>"
'(&#.
*$23*$+"12%&

/,$2$+%>@U2!
6+"- /,$
'(>%1".

B8==3*"#
78,&+*+9
'(&,-".
52$8==3*"1252*&2(((

!"#$%"&'()26+"-S
2222222$+%>@78,&+*+92T2-*.'l8,&+*+9.2U2-*.'3*&"6+"-(l8,&+*+9.(

(ii) It is not practical to use this rule, since items may be stolen or misplaced. So periodic
stocktakes must be taken to determine the exact number in stock, and stocktake
numbers should be stored. Such a rule may be used however to provide default stock
figures which may be compared with stocktake figures to discover discrepancies. In
such a case, a more complex rule is needed to take into account previous discrepancies
as well as stock write-offs (e.g. due to damage) and items that are returned from the
buyer.
Information Modeling and Relational Databases: Answers (odd)–14

Exercise 6.4

1. /,$2+#,D"32,33%:,&>"2%)
C%&"9L-%8&+
'IBHM.

Q-=3%9"" 8$"$ G,#


Q-=3%9""J,-"
'(&#. '(#"RJ#.
/,$

H#*D"#$[*>"&$"
'(&#.
/,$2P2*$2%)

3.
=3,9$
Gi
e*+&"$$4,+*&R !"#$%& B=%#+
'(&#. '()*#$+&,-". Gb '(&,-".
/,$ G`
Gn f`((`ah
G]
*$2"F="#+2,+

Note: If Sport plays no other roles, there is an implied mandatory role constraint on the
righthand role of :$;+/#(<0*=+(,</;&. Why?

5. /,$
B+#""+L11#"$$

*$2*&
B/%= <%:&
[%>,+*%&
'(&#. '(&,-". *$2*&
*$2,+2P2*$2$*+"2%) G*+9
'(&,-".
B8;8#;
/,$
*$2*&
B8;8#;J,-"

Exercise 6.5

1. (a) (i) ORM requires subtypes to be proper, and types (as distinct from their populations) to
be nonempty. For example: B = {1, 2} C = {1}.
(ii) One example is: B = {1, 2} C = {2, 3} D = {2}.
(b) (i) arcs must be directed (is A a subtype of B or vice versa?)
(ii) graph must be acyclic (proper subtype)
(iii) delete arc from C to A (transitively implied)
(iv) graph must be acyclic (proper subtype)
(v) primitive types A and B must be exclusive, so they cannot have a common subtype C
Information Modeling and Relational Databases: Answers (odd)–15

3. (a)
6&>%-"<9=" <,F=,="#
e833&,-"
'(&,-". '+,F)*3"J#.
*$2%)2P2/,$ /,$
fj$,3,#9kS2j;"&")*+kh

Z>>8=,+*%&
Q-=3%9""
'(&,-".
/,$2-,*&U

XQ-=3%9-"&+Y

Q-=3%9"#
V"&")*+Q,#&"#! B,3,#9Q,#&"#!
'(&,-".
:%#@"12)%#
B,3,#9
V"&")*+ 'IBHM.
/,12R#%$$U
'IBHM.
",#&"1
<,F
'IBHM.
=,*1
!2'()"Q-=3%9""20-"'2<,F=,9"#21)$"/,$2-$.&"6&>%-"<9="(
!2'()"V"&")*+Q,#&"#20-"'"<,F=,9"#21)$"/,$26&>%-"<9="2g$,3,#9g(
!2'()"B,3,#9Q,#&"#20-"'2<,F=,9"#21)$"/,$26&>%-"<9="2g;"&")*+g(

Notes: For simplicity, this solution ignores the need to identify employers as taxpayers. If a
salary earner pays no tax we assume this is explicitly recorded as a zero amount. For this
example (and in practice many others) explanatory notes provide a useful supplement to the
basic conceptual schema. In this case, the term “Taxpayer” should be clarified as meaning
“potential payer of tax”, i.e. anybody who has a tax file number. Whether a taxpayer
actually pays tax depends on other factors (e.g. the taxpayer’s income).

(b) *$$8"12P2:,$2*$$8"12;9
Q-=3%9"# <,F!,9-"&+
'(&,-". ?,R"<,FB+,+"-"&+ 'IBHM.
#">%#1$
'(&#.
B,3,#9Q,#&"#! B,3,#9
'IBHM.
:,$2*$$8"12P2:,$2*$$8"12+% #">%#1$
Information Modeling and Relational Databases: Answers (odd)–16

5. fjCkS2jBkS2j?kS2jHkh
/,$2+"#-2%)
C,#*+,3B+,+8$ H8#,+*%&
:,$2*$$8"12P2:,$2*$$8"12+% '9M.
'(>%1".
*$2%)2P2/,$
G3*"&+ [%,&
'(&#. '(&#. [%,&L-%8&+
4"$*1"&+*,3B+,+8$ 'IBHM.
*$2)%#
'(>%1".
*$2%)2P2/,$
fjZkS2jVkS2j4kh

J%&B*&R3" A%-"Z:&"# C%&"9L-%8&+


J#H"="&1,&+$
G3*"&+! Z#V89"#! 'IBHM.
/,$ /,$2/%-"2:%#+/

6&>%-" C,##*"1
'IBHM. G3*"&+!
/,$2$=%8$"2:*+/

C,##*"1
A%-"B/,#"
A%-"Z:&"#
'p.
Z#V89"#! /,$2$=%8$"2:*+/

!2'()2J%&B*&R3"G3*"&+20-"'2G3*"&+21)$2/,$2C,#*+,3B+,+8$2oc2gBg(
!2'()2A%-"Z:&"#Z#V89"#20-"'"G3*"&+21)$2/,$24"$*1"&+*,3B+,+8$20+2fgZgS2gVgh(
!2'()2C,##*"1G3*"&+20-"'2G3*"&+21)$2/,$2C,#*+,3B+,+8$2gCg(
!2'()2C,##*"1A%-"Z:&"#Z#V89"#20-"'2C,##*"1G3*"&+2'+3"'2A%-"Z:&"#Z#V89"#(

Exercise 6.6

1. (a)
0"&1"# :"*R/$ :"*R/$
fjCkS2jekh '(>%1". C,$$ *$2%)
*$2%) '@RM. G,#C%1"3
'(&,-".
Q-=3%9""J,-"
1#*D"$P*$21#*D"&2;9 :,$2-,1"2*&
/,$
Q-=3%9"" G,# W",#
'(&#. '(#"RJ#. 'GQ.
L11#"$$
/,$
B,3,#9 G%$+
'IBHM. 'IBHM.
!/%&"J# ",#&$ /,$
/,$

(b) *$2%)2P2*$2*& :"*R/$


6+"-G,+"R%#9 6+"- C,$$
'(&,-". 'J#. '@RM.

fjQ-=kS2jG,#kh

Q-=3%9""! G,#!
'(&#. '(#"RJ#.

!2'()2Q-=3%9""20-"'+26+"-2,)',2*$2*&26+"-G,+"R%#92jQ-=k(
!2'()2G,#20-"'+26+"-2,)',2*$2*&26+"-G,+"R%#92jG,#k(
Information Modeling and Relational Databases: Answers (odd)–17

1.1 (c) Schema (a) is preferable. Employee and Car are exclusive, with different contextual
identification schemes, and it is unlikely we would want to list them both in the same
column of an output report.

Exercise 7.2

1.
B",$%& fB=#*&RkS2jB8--"#kS
'(&,-". jL8+8-&kS2j?*&+"#kh
fj4kS2jJ4kh

H,+,;,$"q*&1 ] i
78,&+*+9
'(>%1".
1,+,;,$"2$9$+"-$2%)252*&252$%312*&2(((

3.
C%&+/J# f`((`ih
W",#
'GQ. `i 78,&+*+9
XL$$*R&-"&+2rY 52*&252$%312(((

B,3"$="#$%& !#%18>+
'Q-=J#. '(>%1".
`((n
52*&252:,$2,$$*R&"12(((

5. (a)
*$2;9
!"#$%&
'(&#.
L==3*>,+*%&
≤?
'(&#.
L:,#1
'(&#.
*$2)%#

L:,#1B+,+8$
'(>%1".
/,$

(b) /,$
L:,#1B+,+8$
XL==3*>,+*%&Y '(>%1".

!"#$%& L:,#1
'(&#. '(&#.
,==3*"12)%#
IG2*$2:#%&Rr

The spanning uniqueness constraint on the objectified association entails that the same person
applied at most once for the same award, but the same person may apply up to 3 times for the
same award.

Exercise 7.3

1. (a) R, S, T (b) iR (c) iR, S (d) iR, aS, T (e) iR, aS, T (f) R, T (g) iR, S

Note that (g) is not intransitive (e.g. locations at vertices of a triangle).


Information Modeling and Relational Databases: Answers (odd)–18

3. Proof is by reductio ad absurdum, using a deduction tree. The justification column abbreviations
are: P = Premise, NC = Negated Conclusion, df = definition, QN = Quantifier Negation, EI =
Existential Instantiation, UI = Universal Instantiation, PC = Propositional Calculus move, AA
= Affirming the Antecedent (i.e. modus ponens), DC = Denying the Consequent (i.e. modus
tollens).

(a) 1. ∀x ~xRx P (df Irreflex)


2. ∀xyz (xRy & yRz → xRz) P (df Trans)
!3. ~∀xy (xRy → ~yRx) NC (negated Asym)
!4. ∃xy ~( xRy → ~yRx) 3 QN
!5. ~(aRb → ~bRa) 4 EI
6. aRb 5 PC
7. bRa 5 PC
!8. aRb & bRa → aRa 2 UI
9. aRa 6,7,8 AA
10. ~aRa 1 UI
X 9, 10

(b) 1. ∀xy (xRy → yRx) P (df Sym)


2. ∀xyz (xRy & yRz → xRz) P (df Trans)
!3. ~∀xy (xRy ∨ yRx → xRx) NC (negated PopReflex)
!4. ∃xy ~( xRy ∨ yRx → xRx) 3 QN
!5. ~( aRb ∨ bRa → aRa) 4 EI
!6. aRb ∨ bRa 5 PC
7. ~aRa 5 PC
8. aRb → bRa 1 UI
9. bRa → aRb 1 UI
!10. aRb & bRa → aRa 2 UI
!11. ~(aRb & bRa) 10,7 DC
/ \
12. aRb bRa 6 PC
13. bRa aRb 8, 12a AA; 9,12b AA
14. aRa aRa 10,12,13 AA
X X

5. The schema is shown with sample data. If storage is not a problem,


use a symmetric relation like this (symmetry can be enforced at G%8&+#9r
'(&,-".
update to simplify data entry).
If storage is a problem, use an asymmetric relation (add
asymmetric constraint), say baseBorders (base table for borders), ;%#1"#$
and add the derivation rule: >/-#&;=?( ./;@$;+( >/-#&;=A( !""# >/-#&;=?(
2V"3R*8- 2e#,&>"
.*+$B/;@$;+(>/-#&;=A($%(>/-#&;=A(.*+$B/;@$;+(>/-#&;=?. 2V"3R*8- 20"#-,&9
2V"3R*8- 2[8F"-;%8#R
2V"3R*8- 2J"+/"#3,&1$
2e#,&>" 2V"3R*8-
2((( 2(((
Information Modeling and Relational Databases: Answers (odd)–19

Exercise 7.4
1. (a)
/,$
!%$*+*%&J# f`((`bh

*$2*&
48R;9<",-
!"#$%&J,-" 48R;9!3,9"#
'(&,-".
*$2%)2P2/,$ /,$ ≤2`b
(b)
!%$*+*%&J# f`((`bh

*$2*&
48R;9<",-
!"#$%&J,-" 48R;9!3,9"# s2T2`
'(&,-".
*$2%)2P2/,$ ≤2`b

(c) /,$2P2*$2%)
!"#$%&J,-" 48R;9!3,9"# !%$*+*%&J# f`((`bh
*$2%)2P2/,$

3.
/,$2-*&*-8-U
Note: If we assume complete data, there is
fjG/*31kS2jW%8+/kS LR"G,+"R%#9 LR" a textual constraint that ensures subsequent
o
L183+kS2jB"&*%#kh '(&,-". '9M. age categories have a minimum age 1
above the maximum age of the previous
/,$2-,F*-8-U
age category.

5. s2≤2ia

fj!GkS G%-=8+"#q*&1 J%1" J%1"e8&>+*%&


fjeBkS
jC,>kh '(>%1". '(3"++"#. '(>%1".
*$2%)2P2/,$ /,$ j?Bkh

G,;3"["&R+/ G!I)#"l8"&>9
?%#@B+,+*%&! e*3"B"#D"#!
'-M. 'CAtM.
*$2%)2P2/,$ /,$
s2≤2`
!2'()2?%#@B+,+*%&20-"'2J%1"2,)',2/,$2J%1"e8&>+*%&2g?Bg(
!2'()2e*3"B"#D"#20-"'2J%1"2,)',2/,$2J%1"e8&>+*%&2geBg(

Aliter, simply assert the subtypes in stead of deriving them:

fj!GkS G%-=8+"#q*&1 J%1" s2≤2ia


jC,>kh '(>%1". '(3"++"#.
*$2%)2P2/,$

s2≤2`
G,;3"["&R+/ G!I)#"l8"&>9
?%#@B+,+*%& e*3"B"#D"#
'-M. 'CAtM.
*$2%)2P2/,$ /,$
Information Modeling and Relational Databases: Answers (odd)–20

7. The schema is as earlier, but with the following derivation rules added:
:*;&?(8/#&*"#+(:*;&A((!"((:*;&?(@";$8&0=(8/#&*"#+(:*;&A(
:*;&?(8/#&*"#+(:*;&A((!"((:*;&?(@";$8&0=(8/#&*"#+(&$'((:*;&C()*+)!8/#&*"#+(:*;&A(

Exercise 7.5

1.1 Regarding the left hand fact types:


If A’s role in S is populated with a, say, then a must also play A’s role in R (since the pair-
subset constraint implies subset constraints on corresponding roles). But this violates the
exclusion constraint. Hence the constraint pattern is population-inconsistent.

Regarding the right hand fact types:


If S is meant to identify a typed predicate predicate, then replace it by another symbol to avoid
conflation with the other S predicate.
The combination of the subset constraint and the simple UC implies a simple UC on the left
role of T.

3. The supplied predicate was supposed to have the reading “… located in … ordered … of …”.
Assuming the population is significant in the sense that each bookshop is located in only one
city, the schema should be split into two fact types as shown below:

78,&+*+9
'(&#.
*$2*&
G*+9 V%%@$/%= V%%@
'(&,-". '(&,-". '6BVJ.
52%#1"#"1252%)2(((

5. The grandparent_of relation is semiderived (partly stored and partly derived). This allows
storing of the fact that David is a grandparent of Chris without knowing who David’s children
are. However, suppose we now attempt to store the fact that Ann is a grandparent of Chris. If this
fact is accepted, we have derived redundancy since this fact can be derived from the stored facts
that Ann is a parent of Bob, and Bob is a parent of Chris, given the derivation rule. This kind of
derived redundancy is typically harmless, but if such redundancy is not desired, special
exclusion and update constraints may be used.
Information Modeling and Relational Databases: Answers (odd)–21

7. This solution was produced with the NORMA tool, using 3 pages named as shown below.

Moon Missions:

Astronauts:

Moons&Planets:

*$2%) F'-
4$3595:& 67/$%.*='8
67+'.&8 f2a((`aa2h
!]
/,$ 4$35 <&%(&+,'@&
>'.&95:& 67+'.&8 67+%8
52/,$2,+-%$=/"#*>U252*&25
67+'.&8
/,$
/,$ *$2#*&R"12m
>%D0+@-
>'.&?%0@0+ >$%.'=>'.&34$35!
N,DR<"-="#,+8#"O
/,$2,D"#,R"U /,$2m
;$$+! <='+&,!
mQ,>/2J%#-,3J,-"1V%192*$2,2V%19 9&.:&%',*%&
#')%&+)&0,E'=*&
+/,+2/,$2J,-"<9="2gJ%#-,3g( 6ABC8
N-*&<"-="#,+8#"O m2e%#2",>/2<"-="#,+8#"S
mQ,>/2C%%&2*$2,2V%19 m2!3,&"+2*$2#*&R"12*)) ),/#"&/"*+\,38"2T2ni2_2`(dmuG\,38"
+/,+2*$2%)2V%19<9="2gC%%&g( !3,&"+2/,$2J#4*&R$2c2a /,$2-*&U
N-,F<"-="#,+8#"O
mQ,>/2!3,&"+2*$2,2V%19
/,$2-,FU
+/,+2*$2%)2V%19<9="2g!3,&"+g( /,$
9&.:&%',*%&D'+@&
Information Modeling and Relational Databases: Answers (odd)–22

Exercise 8.5

1. Here is an ORM solution: :,$2;%8R/+2%&

H,+"
'-19.
/,$
fj0%%1kS2jZqkS B+,+8$ *$23",$"12+*33
j!%%#kS2jvkh '(&,-".
/,$
:,$2#"+8#&"12%& :,$2*$$8"12%&
G%=9J#
\*1"%<,="
C%D*" C%D*" [%,&
<*+3" '(>%1". '(&#.
/,$ *$2%) :,$2#"&+"12%&
X[%,&26+"-2rY /,$
G,+"R%#9 C%&+/ f`((`ih :,$2>/,#R"12+%
'(>%1". '(&#. G8$+%-"#J,-"
*$2*&
/,$
fj0kS2j!0kS2jCkS 4,&@ QF>381"1
/,$ jCLkS2j4kh '(&#. L11#"$$
52*&252/,12((( \*1"%<,="! G8$+%-"#
'(&#. /,$
!/%&"J#
*$2:#*++"&2%))
G,+"R%#9 /,$
G%--"&+
H"$>#*=+*%& !"#*%1
'(>%1".
!2'()2QF>381"1\*1"%<,="20-"'2\*1"%<,="2,)',2/,$2B+,+8$2gvg( -,922;"2>,33"12*&
fjHkS2jJkS2jHwJkh

Here is the solution in Barker ER notation, using superscripts to annotate model elements with
textual constraints not expressible in the graphic notation. As an additional exercise, suppose
that no ties are allowed for movie rankings (so each monthNr, rank pair is assigned to at most
one Movie). Add this constraint to both the ORM and the Barker ER solutions. (Hint: you can
do this graphically in ORM but not in Barker ER).

2CZ\6Q24LJq6J0

)%# 222222222\6HQZ<L!Q
22[ZLJ26<QC s2"!22-%&+/J#2b
2222!22#,&@
$22#"+8#&H,+" #"&+"12%& s2"!22>%=9J#
2222!22$+,+8$2`
222"$22=8#>/,$"H,+"2i
*&>381"12*& %)
2222$223",$"QF=*#9H,+"2i

*&>381" 2222QvG[IHQH
2222\6HQZ<L!Q2n ,$$*R&"1
2222222[ZLJ %) 22222222CZ\6Q
22!22*$?#*++"&Z))2]
s22!223%,&J# 22!22>%--"&+ %& s2"!22-%D*"G%1"
2222!22*$$8"H,+" 2222!22-%D*"<*+3"

>/,#R"12+% 222Z<AQ4 *&


222\6HQZ<L!Q

>/,#R"12)%#
%)
22222GIB<ZCQ4 `22\*1"%<,="($+,+8$2*&2fg0%%1gS2gZqgS2g!%%#gS2gvgh
22222GL<Q0Z4W
i22'=8#>/,$"H,+"2*$2&%+2&8332,&123",$"QF=*#9H,+"2*$2&833.2%#
s22!22>8$+%-"#J# 2222'=8#>/,$"H,+"2*$2&8332,&123",$"QF=*#9H,+"2*$2&%+2&833. s2"!22>,+"R%#9G%1"2^
2222!22>8$+%-"#J,-"2d n22Q,>/2QF>381"1\*1"%<,="2*$2,2\*1"%<,="
2222!221"$>#*=+*%&2x
2222!22,11#"$$2d 222222:/"#"2\*1"%<,="($+,+8$2T2gvg
2222$22>,33!"#*%12yS2`a ]22QF>381"1\*1"%<,="(*$?#*++"&Z))2/,$2V%%3",&21%-,*&
2222$22=/%&"J#2`a b22C%D*"4,&@*&R(-%&+/J#2*&2f`((`ih
^22G,+"R%#9(>,+"R%#9G%1"2*&2fg0gS2g!0gS2gCgS2gCLgS2g4gh
x22G,+"R%#9(1"$>#*=+*%&2*$28&*l8"
d22'G8$+%-"#(>8$+%-"#J#S2G8$+%-"#(>8$+%-"#J,-".2*$28&*l8"
y22G8$+%-"#(>,33!"#*%12*&2fgHgS2gJgS2gHwJgh
`a22'G8$+%-"#(>,33!"#*%12*$2&%+2&8332,&12G8$+%-"#(=/%&"J#2*$2&%+2&833.2%#

22222'G8$+%-"#(>,33!"#*%12*$2&8332,&12G8$+%-"#(=/%&"J#2*$2&833.
Information Modeling and Relational Databases: Answers (odd)–23

Exercise 9.8

1. (a) Here is an ORM solution:

fjZqkS ["&R+/
2j),83+9kh '-M.
*$2%)2P2/,$
[*&"B+,+8$
'(&,-". *$2%)
[*&@<9="
*$2%) H"$>#*=+*%&
$+,#+$2,+ '(>%1".
/,$2P2*$2%)

B:*+>/B+,+" [*&"[*&@ G8##"&+


'(&,-". "&1$2,+ '(&#. 'LM.
>,##*"$
fjZ="&kS J#!/,$"$ f`((nh
2jG3%$"1kh \%3+,R"
'\M.
*$ *$ /,$ *$2*&
)#%- W",#
+%
!%:"# 'GQ.
/,$
'@?M. /,$
/,$2!
*$2%)2P2/,$
J%1" 78,#+"# 78,#+"#J# f`((]h
J#e8$"$ $"#D*>"$
'(>%1".
G%&$8-"# Q&"#R9
'(&#. '@?/M.
52*&2528$"12(((

:,$2#"=%#+"12;9 e,83+G,8$"
/,$ '(&,-".
/,1
e,83+2r
e,83+<9="
<#,&$)%#-"#<9="
'(&,-". 6&$+,&+
'(>%1". *$2%) 6&$+,&+
'9-1/-.
:,$2)*F"12,+ '9-1/-.
!#$%"&'()2[*&"[*&@S 6&$+,&+
6&$+,&+
2222=%:"#2T2D%3+,R"2m2>8##"&+2P2`aaa( '9-1/-.
'9-1/-. :,$2#"=%#+"12,+
Here is a UML solution.

G0+&G0+H z"&8-"#,+*%&{
G0+H95:&
! ` 2J,',*-
&#2f!h
>%1"2f!h
$+,+8$M2B+,+8$ Zq
1"$>#*=+*%&2fI`h
3"&R+/ ),83+9
$+,#+B+,+"M2B:*+>/B+,+"
3*&@B+,#+ )#%-J%1"
"&1B+,+"M2B:*>+/B+,+" z"&8-"#,+*%&{
>8##"&+ ! ` >$3&
2J10,()J,',&
D%3+,R"
P=%:"# ! ` >%1"2f!h Z="&
&#e8$"$ G3%$"1
3*&@Q&1 +%J%1" +#,&$)%#-"#<9="2Na((`O

!
f=%:"#2T f[*&"[*&@()#%-J%1"2oc ",>/2&%1"2+/,+2$"#D*>"$2,
222D%3+,R"2m2>8##"&+P`aaah [*&"[*&@(+%J%1"h >%&$8-"#2/,$2*+$
+#,&$)%#-"#2+9="2#">%#1"1
!
I*'%,&% B$+-*.&% ` ! #'*=,
! !
9",#J#2f!h &#2f!h +9="
l+#J#2f!h2f2D,38"2*&2#,&R"2`((]2h &#!/,$"$2f2D,38"2*&2#,&R"2`((n2h +*-"
+*-"e*F"12Na((`O
>,8$"2Na((`O
B$+-*.&%I*'%,&%

"&"#R9I$"1 '>%&$8-"#S2+9="S2+*-".2*$28&*l8"
Information Modeling and Relational Databases: Answers (odd)–24

1. (b) Introduce a simple identifier for fault (e.g. FaultId). This is advisable even if we model Fault
directly as shown in the previous solutions rather than as an objectified association.

Exercise 10.1

1.1 (a)

Employment_A Employment_B
enr pnr startdate enddate enr pnr startdate enddate
e1 p1 d1 d3 e1 p1 d1 d4
e2 p2 d2 ? e2 p1 d2 ?
e3 p1 d2 ? e3 p1 d3 ?

(b) outer join semantics for UC on (pnr, enddate), i.e. UC applies to outer join
(c) inner join semantics, i.e. UC applies to inner join
(d) ,*(,-1(.$)#(/!&)&(
1&(0(,)(<#;D($#@@*&$("%$'(E'<0/='$#&F2(
1%$23#45(<#;D($#@@*&$(
*+6!.1#,$2.)1G6(H(?(6(6(
(e) ,*(,-1(.$)#(/!&)&(
1&(0(,)(<#;D($#@@*&$("%$'(E'<0/='$#&FB(
7*(%(($#@@*&$(!&#.$)#.200#
1%$23#45(<#;D($#@@*&$(
*+6!.1#,$2.)1G6(H(?(6(6

3. #"l8*#"$2#"D*":2;9
!"#$%&
'(&#.

4"D*":L$$*R&-"&+ ,8+/%#"1
'(&#.

V%%@
'6BVJ.
#"l8*#"$2#"D*":2%)

Exercise 10.2

1. (a) No (b) Yes (c) Yes (d) Yes

3.
/,$
Q-=3%9""J,-"
Q-=3%9""
'(&#.
B%>*,3B">8#*+9J#
/,$
Information Modeling and Relational Databases: Answers (odd)–25

Exercise 10.3

1.1 (a)
<*-"
'9-1/-$. /,$2$9$+%3*>U
N+"$+<*-"O
/,$ NV!O
!,+*"&+ !#"$$8#"
!,+*"&+J,-" V3%%1!#"$$8#"
'(&#. '--ARM.
52,+252/,12(((
/,$21*,$+%3*>U
N3,+"$+V!O
/,$23,+"$+U2! <"F+8,32>%&$+#,*&+2'&%+2#"l8*#"1.M
!"#$%"&'()2!,+*"&+S 22e%#2",>/2V3%%1!#"$$8#"S
222223,+"$+V!2T2V!21)&%&2+"$+<*-"2T2.'K'+"$+<*-"2$/",)',2!,+*"&+.( 2222$9$+%3*>V!2c21*,$+%3*>V!(

(b) N+"$+<*-"O
:,$2+,@"&2,+
<*-" V!-",$8#"-"&+
'9-1/-$. '(&#.

NV!+"$+O 9*"31"1
*$2%) /,$2$9$+%3*>U
NV!O
/,$
!,+*"&+ !#"$$8#"
!,+*"&+J,-" V3%%1!#"$$8#"
'(&#. '--ARM.
/,$23,+"$+U2!
N3,+"$+V!O
/,$21*,$+%3*>U
!"#$%"&'()2!,+*"&+S
222223,+"$+V!2T2V!+"$+(V!21)&%&2V!+"$+(+"$+<*-"2T2.'K'V!+"$+(+"$+<*-"2$/",)',2!,+*"&+.(

3. (a) It doesn’t indicate which end date goes with which start date (this connection could be
derived based on temporal ordering for a given habitation, but this is a lot of work). It
doesn’t capture the constraint that a person can live in at most one country for any given
period. There is also an equivocation on “Habitation”— the usage in the original schema
treats different occurrences of a person living in a country as the same habitation, which
is not the way the term is used in the domain description.

(b)
*$2%)
!"#$%&
'(&,-".
G%8&+#9
A,;*+,+*%&
'(>%1".
*$2*&
H,+"
'9-1.
$+,#+"12%&

"&1"12%&

6R&%#"2+/"2$+#%&R"#2>%&$+#,*&+2+/,+2/,;*+,+*%&2="#*%1$21%&k+2%D"#3,=(
L3$%2*R&%#"2D,38"2>%&$+#,*&+M2e%#2",>/2A,;*+,+*%&S2"&1H,+"2cT2$+,#+H,+"(

5. (a) (i) If D is a subtype of B and C, it includes an instance that belongs to both B and C. But B
and C are mutually exclusive. So this is impossible.
(ii) Student is a role type, so all its instances may join or leave this type during their lifetime.
If Person is a subtype of Student, when an instance leaves the Student type it also leaves
the Person type. But this is impossible since Person is a rigid type (no instance can ever
leave it during its lifetime).
Information Modeling and Relational Databases: Answers (odd)–26

5. (b) Using the decreasing disjunctions pattern:

L==3*>,+*%&e%#- !"#$%&
!"#$%&J,-"
'(&#. '(&#.
:,$2)*3"12;9 /,$

"&1"12%&
Q-=3%9""2%#2L38-&*
:,$2/*#"12%&
XA*#"2rY
H,+"
L38-&* '-19.

3,$+2E%*&"12,38-&*2,$$%>*,+*%&2%&

Using the role-playing pattern:


XQ-=3%9-"&+4%3"!3,9*&RY

!"#$%& Q-=3%9-"&+4%3" fjL==3*>,&+kS


'(&#. '(&,-". 2jQ-=3%9""kS
=3,9$ 2jL38-&*kh

3,$+2E%*&"12,38-&*2,$$%>*,+*%&2%&
L==3*>,+*%&e%#- !"#$%& !"#$%&L$ !"#$%&
'(&#. L$L==3*>,&+! Q-=3%9""! L$L38-&*!
:,$2)*3"12;9
H,+"
'-19.

XA*#"2rY
:,$2/*#"12%& "&1"12%&
!2'()2!"#$%&L$L==3*>,&+20-"'+2Q-=3%9-"&+4%3"!3,9*&R"2,)',2*&D%3D"$2Q-=3%9-"&+4%3"2jL==3*>,&+k(
!2'()2!"#$%&L$Q-=3%9""20-"'+2Q-=3%9-"&+4%3"!3,9*&R2,)',2*&D%3D"$2Q-=3%9-"&+4%3"2jQ-=3%9""k(
!2'()2!"#$%&L$L38-&*20-"'+2Q-=3%9-"&+4%3"!3,9*&R2,)',2*&D%3D"$2Q-=3%9-"&+4%3"2jL38-&*k(

Exercise 10.4

1. (a) *$2=%:"#"12;9
[%>%-%+*D"
'(&#.
<#,*&
'(&#. XG,##*,R"<#,*&Y
-&L f`((nh

G,##*,R" G,##*,R"G3,$$
*&>381"$ '(&#. '(&#.
*$2%)

Allow CarriageTrain role to be mandatory


Information Modeling and Relational Databases: Answers (odd)–27

1. (b) *$2=%:"#"12;9
[%>%-%+*D"
'(&#.
<#,*&
'(&#. @MA f`((nh

G,##*,R" G,##*,R"G3,$$
'(&#. '(&#.
52,+252/,$2((( *$2%)

!%$*+*%&
'(&#. f`((h
#$%"&'()2<#,*&S2!%$*+*%&2N'=*&-"'%&"-&L*&+,0'="/%$.2`(

aliter:
*$2=%:"#"12;9
[%>%-%+*D"
'(&#.
!%$*+*%&
<#,*& f`((h
'(&#.
'(&#. f`((nh

G,##*,R"<#,*& G,##*,R" G,##*,R"G3,$$


'(*1. '(&#. '(&#.
*&>381"$ 52,+252/,$2((( *$2%)

allow other CarriageTrain role to be mandatory

aliter:

*$2=%:"#"12;9
[%>%-%+*D"
'(&#.
!%$*+*%&
<#,*& f`((h
'(&#.
'(&#. f`((nh

G,##*,R" G,##*,R"G3,$$
G,##*,R"<#,*&
'(&#. '(&#.
*&>381"$ 52,+252/,$2((( *$2%)

(c) *$2=%:"#"12;9
[%>%-%+*D"
'(&#.
<#,*& !
'(&#. XG,##*,R"<#,*&Y
-&L f`((nh

G,##*,R" G,##*,R"G3,$$
*&>381"$ '(&#. '(&#.
*$2%)

The external UC added above captures the constraint, but is not needed since it is
implied by the internal uniqueness constraint on the right-hand role of the includes
predicate.

(d) No for first solution. Yes for alternative solution (same explanation as for (c)) .
(e) No.
Information Modeling and Relational Databases: Answers (odd)–28

1. (f) *$2=%:"#"12;9
[%>%-%+*D"
'(&#.
<#,*& *$2%&
'(&#. f`((nh

G,##*,R" G,##*,R"G3,$$
'(&#. '(&#.
*$2%)
!%$*+*%&
f`((h
'(&#. /,$

(g) No.

Exercise 10.5

1.1 (a) propositional


(b) situational
(c) propositional

3. /,12=#"$*1"&>9U
L==#%D,34,+*&R
'(&#.

0"&1"# !#"$*1"&+ H,+"


'(>%1". '(&,-". '-19.
*$2%) ;"R,&2=#"$*1"&>92%&
fjCkS2jekh

"&1"12=#"$*1"&>92%&
Exercise 10.6

1. Negation Approach Pat is male Pat is a parent


Negation as Failure False False
Classical Negation UNK UNK
Semipositive Negation False UNK

Exercise 10.7
z"&8-"#,+*%&{
1.1 (a) <&%-$+ ! <&%-$+95:&
`
+9=" -,3"!"#$%&
*12f!h )"-,3"!"#$%&
f>%-=3"+"S
1*$E%*&+h M2!"#$%&<9="

;'=&<&%-$+ #&.'=&<&%-$+

=#%$+,+"B+,+8$2Na((`O

(b) We are forced to introduce the FemalePerson subclass even though it plays no specific
roles. There is no formal connection between the subclasses and the enumeration values
(e.g. it is possible to record prostate status for persons of type femalePerson). The
personType association carries little semantics (e.g. one must inspect the enumerated
values to determine anything about the classification criteria). Finally, second-order
semantics are harder to implement that first-order.
Information Modeling and Relational Databases: Answers (odd)–29

1. (c)
!"#$%& 0"&1"# fjC,3"kS
'(*1. '(&,-". je"-,3"kh
*$2%)

!#%$+,+"B+,+8$
C,3"!"#$%&!
'(1"$>#*=+*%&.
/,$

!2'()2C,3"!"#$%&20-"'2!"#$%&21)$2*$2%)20"&1"#2jC,3"k(

3. Let A denote the set of all sets that are not members of themselves. Either A is a member of A or
it’s not member of A. If A is a member of A, then by definition it’s a set that is not a member of
itself, so A is not a member of A. If A is not a member of A, then by definition A is a member of
A. Hence it’s both true and false that A is a member of itself, which is contradictory.

Exercise 11.2

1.1 (a)
*$2%)2P2/,$ C,#+*,3L#+
0"&1"# '(&,-".
fgCgSgegh '(>%1".
C"-;"# 4,&@
'(&,-". '(&,-".
52*&252/,$2(((
!/%&"J#
*$2%)2P2/,$

(b) The attribute “Arts and ranks” is multivalued, not atomic-valued.


(c) Member ( membername, gender, [phone] )
{M, F}

Ranked ( membername, art, rank )

(d) The nested relation allows all details about members to be retrieved without a table join, so
is more efficient for such queries. Moreover the subset constraint is no longer needed. On
the negative side, allowing nesting leads to a more complex query language, and queries to
determine who has an art or rank are somewhat less efficient than for the relational
solution.
As an extra exercise, modify answers (a) and (c) to unpack the semantics of ranks into a rank
type (dan or kyu) and level (1..).

Exercise 11.3

1. ()$*+&#,-1B12/='C1&+8%0.'&4"1D

.++/11111B12/='C1828*"C1"<2820'1D

0)12%3$1B1/+=E"$8F0<"C1$."<28C1!/"8:"#8,1D

455%&#,-1B1/+=E"$8F0<"C1/"4"/8".1D
Information Modeling and Relational Databases: Answers (odd)–30

3. (a) The table allows redundancy. For example, with the following population the fact that dress
d1 costs $50 is duplicated:

Likes ( woman, dress, cost )


Eve d1 50
Sue d1 50

3.1 (b)
6#/%7 B1G04&'H&4"C1<."//F0<"1D

8&%77 B1<."//F0<"C1$0/8C1!0G'".,1D

9+:!, B1G04&'H&4"C1G&("1D

5. (a) (b)
;&+2%3$ B15.0E"$8F0<"C14(.H&4"C1=+<("81D =:>"+?%%@11B1"45H.C1<"58H&4"C1/&*&.61D

<!,!-%& B14(.H&4"C1/&*&.6C1=2.8%I"&.1D 8%>!&$:%,$1B1<"58'&4"C1=+<("81D

Note: Other facts are derived. The equality constraints above are based on the population
provided. In practice, these constraints would usually be at most subset constraints.

7. .&!,3* B1=.&'$%H.C1=.&'$%H&4"1D

A!B>!?%& B18&#J2*"H.C18&#5&6".'&4"C1!G0.;=.&'$%H.,!C1!5%0'"H.,1D

(33+),$C7%& B1=.&'$%H.C1&$$0+'8H.C18&#J2*"H.1D

@7M-CN7OA
A&!,7!3$#+, B1=.&'$%H.C1&$$0+'8H.C18.&'H.C18.&'7&8"C1&40+'8C18.&':65"C1=&*&'$"""#D

1111111!
1$%&&#'$&(#)*18&#J2*"H.1)$1K$$0+'8L/".>8&#J2*"H.

""1'$#+,-./-1&$$0+'8H.

=&*&'$"1PQ1R9
111'$#%01./-1:.&'/&$820'
)*18.&':65"1Q1S7M-S1/2-$#=&*&'$"1PQ1'&11=&*&'$"1T1&40+'89
)*18.&':65"1Q1SN7OS1/2-$#=&*&'$"1PQ1'&11=&*&'$"1U1&40+'8
Information Modeling and Relational Databases: Answers (odd)–31

9. (a)
XQ&#%33-"&+Y

B+81"&+ B8;E">+
'(&#. '(>%1".
"&#%33"12*&

52%&252R%+2(((
B>%#"

<"$+ D%7)"$1B1/8+<"'8H.C1/+=E"$8F0<"C18"/8H.C1/$0."1D
'(&#.

(b)
XQ&#%33-"&+2rY

B+81"&+ B8;E">+
'(&#. '(>%1".
"&#%33"12*&

52%&252R%+2(((
B>%#"

<"$+
=,&+"":%,$1B1/8+<"'8H.C1/+=E"$8F0<"1D
'(&#.

D%7)"$1111111B1/8+<"'8H.C1/+=E"$8F0<"C18"/8H.C1/$0."1D

11. (a)
1111111111@R>>VWRA11@R>>VXYA111111@R>>VXYA 11111@:)C1H-A
;%&7+,1B130.4H.C1&("C18Z[0+./C15&5".[0+./C1!3&ZF%&''"*,!C1!3&Z-&5".,3C1!5."3H"G/,41D

V
1-5)6/6#)**18Z[0+./1\1R
]
1-5)6/6#)**15&5".[0+./1\1R
?
1-5)6/6#)**18Z[0+./1\1R1.$115&5".[0+./1\1R1.$11&("1\Q1VY

(b) 111111111111111111@R>>VWRA11@R>>VXYA1111111@R>>VXYA
;%&7+,@ 1B130.4H.C1&("C18Z[0+./C15&5".[0+./1D
3
!

D%!E%&@ 1B130.4H.C13&Z-&5".1D
4

F#%G%& 1B130.4H.C13&ZF%&''"*1D

1111@:)C1H-A
<%E#!(E)"$B130.4H.C15."3H"G/1D

V
1-5.+/&(#72-,-18Z[0+./1\1R
]1-5.+/&(#72-,-15&5".[0+./1\1R
?
1-5.+/&(#72-,-18Z[0+./1\1R1.$115&5".[0+./1\1R1.$11&("1\Q1VY

For most applications, schema (a) is preferable.


Information Modeling and Relational Databases: Answers (odd)–32

13.
($:+7>*%&% B1=0<6H&4"C1(&/1D
!

0+"!&.+E? B1=0<6H&4"C1=0<6^2'<C1.&<2+/C1!4&//,3C1!0.=28&*-".20<,4C
111111111111!/0*&._"5&.&820',8C1!&55&."'8`&(C15*&'"8a.=28"<,9C
111111111111!'"#8b'3F0'E,:C1!'"#8a550/',;1D

V1'$&(#72-,-1=0<6^2'<1Q1S5*&'"8S
]
1-5)6/6#)**1=0<6^2'<1)$1@S/+'SCS5*&'"8SA
?
1-5)6/6#)**1=0<6^2'<1)$1@S5*&'"8SCS400'SA
W1-5)6/6#)**1=0<6^2'<1Q1S5*&'"8S
c
1-5)6/6#)**1=0<6^2'<1Q1S400'S
X1-5)6/6#)**1/0*&._"5&.&820'1d1V
e1
-5)6/6#)**1/0*&._"5&.&820'1\1V

f1-*&'"81B5*&'"8H&4"C1'.`00'/D11PPQ1#6-&-+/15*&'"8a.=28"<C1+'%$/1BfD
11111111111*,'<1_0*&.g0<6
###########=,'%0#>(15*&'"8a.=28"<
f1V1&+1Q1VcRRRRRRR1;4

15. H+),$&?1B1$0+'8.6H&4"1D 1111111UU12'$*+<"/1K+/8.&*2&

! !
.+&E%&71B1$0+'8.6VC1$0+'8.6]1D #),,-*&-5)?-

17.
0+5$G!&% B1/038G&."H&4"C15.0<+$".1D

0+5$G!&%C7% B1/038G&."H&4"C1<"58H&4"1D

0)12%3$ B1/+=E"$8F0<"C1<"58H&4"1D

6%3$)&%& B1"45H.C1*"$8+.".H&4"C1!/+=E"$8F0<",C1<"58H&4"D

I,7$&)3$7 B1"45H.C1/8+<"'8_+.'&4"C1/8+<"'8b'282&*/1D

(G!&E%E B1"45H.C1<"(.""F0<"C1+'2C1&G&.<I"&.1D

@6C'A
=,&+"":%,$ B1/8+<"'8_+.'&4"C1/8+<"'8b'282&*/C1<"(.""F0<"C1+'2C1$045*"8"<1D

@S-:SCSJ:SA @S2'8SCS"#8SA
=,&+"$J%!& B1/8+<"'8_+.'&4"C1/8+<"'8b'282&*/C1<"(.""F0<"C1+'2C16.C1824"`0<"C15*&$"`0<"1D

1111111111111@`CJA
0$)E%,$ 111B1/8+<"'8_+.'&4"C1/8+<"'8b'282&*/C1("'<".1D
Information Modeling and Relational Databases: Answers (odd)–33

19. (a) We introduce IllnessOccurrence(.nr) to allow recording of multiple instances of the


same illness by the same client. The solution makes several simplifying assumptions,
and does cater for full history (e.g., typically clients are entered in the system before
making payments, and clients may change their method of payment or credit cards
used over time).

B-%@*&RB+,+8$ fgJBgS2gBgh
/,$2-*&U '(>%1".

52:*+/252,&1252/,$2((( 633&"$$
LR" LR"0#%8=O !#"-*8- '(&,-".
o
'9M. '(&#. 'IBHM.
i
G%D"#
/,$2-,FU *$2%)
/,$ 'IBHM.
4">%D"#9H"R#""
*$2*&2! 'p.
633&"$$Z>>8##"&>" /,1
#"l8"$+"1
'(&#.
/,$2! :,$2$8))"#"122;9 A%$=*+,3
Q-=B+,+8$ G3*"&+ '(&,-".
L&&8,3e"" :,$2+#",+"12,+
'(>%1". '(&#.
/,$ 'IBHM.
f2gQLgS2gBQgS2gJQg2h =,9$2!!

!,9C"+/%1
'(>%1". f2gGBAgS2gGA7gS2gG4Hg2h
=,9$2;9
:,$2#")"##"12;9
N1,+"!,*1O
=,*12%&2P H,+"
H,+"
'-19.
'-19.
:,$2;%#&2%& N;*#+/1,+"O

!"#$%"&'()2G3*"&+S2,R"2T2',$3'52U2;*#+/1,+".(5&'%-(
!2G3*"&+2*$2*&2LR"0#%8=20//2G3*"&+(,R"2cT2,R"0#%8=(-*&LR"2'+32G3*"&+(,R"2oT2,R"0#%8=(-,FLR"(
!!2!,9-"&+2l8%+"2*$21"#*D"12)%#2>8##"&+21,+"28$*&R2;*#+/1,+"S2$-%@*&R2$+,+8$2,&12=#%=%$"12>%D"#S
22222+/"&2$+%#"12,$2=,9-"&+2*)2=,*12%&2+/,+21,+"(2e%#2$*-=3*>*+9S2,$$8-"2=,9-"&+2*$2%&21,92%)2l8%+"(
22G3*"&+2=,9$2L&&8,3e""20//
G3*"&+2*$2*&2LR"0#%8=2'+32/,$2B-%@*&RB+,+8$2'+32#"l8"$+"12G%D"#2'+3
,)',"LR"0#%8=2:*+/2,)',2B-%@*&RB+,+8$2,&12,)',2G%D"#2/,$2!#"-*8-2'+3
L&&8,3e""2T2`i2m2,)',2!#"-*8-(

O20#%8=
&_`(-*&LR"2T20#%8=&(-,FLR"2_2`2UU2:/"#"2;%+/2R#%8=$2"F*$+
P""#$%"&'()2G,#1!,9"#S

1,+"!,*12oT2>#"1*+G,#1("F=*#9H,+"(22UU2+/*$2,==3*"$2,+2+*-"2%)2=,9-"&+
Subtyping:
G3*"&+
'(&#.

/,$2"F=*#9U
|%; H,+"
'(&,-". H,+"
/,$ ≤2i '-19.
'-19.
G#"1*+G,#1
Q-=3%9"1G3*"&+! G,#1!,9"#!
'(&#.
!/%&"J# 8$"$ G,#1<9="
/,$2:%#@U '(>%1".
8$"$ *$2%)
L>>%8&+*&Re*#-
B"3)Q-=3%9"1G3*"&+! f2gVGgS2gCGgS2g\Bg2h
'(&,-".

!2'()2G,#1!,9"#20-"'2G3*"&+21)$2=,9$2;92!,9C"+/%12gG4Hg(
!2'()2Q-=3%9"1G3*"&+20-"'2G3*"&+21)$2/,$2Q-=B+,+8$2oc2gJQg(
!2'()2B"3)Q-=3%9"1G3*"&+20-"'2G3*"&+21)$2/,$2Q-=B+,+8$2gBQg(
Information Modeling and Relational Databases: Answers (odd)–34

19. (b) Even if a quoted payment were derived somehow, the actual payment would need to
be stored since it might not be derivable in the future (e.g., the premium schedule might then be
different, and historical records of premiums are not kept in this UoD).

(c)
(-%K&+)>!A#3 B1&("h.0+5H.C142'K("C14&#K("1D

11111111111111111] 111111111@H_C1_A
03*%E)"% B1&("h.0+5H.C1$0Z".C1/40;2'(_8&8+/C15."42+41D

H"#%,$I"",%77B1$*2"'8H.C12**'"//C1."$0Z".6-".$"'8C1%0/528&*H&4"1D

111111111111110!7 @H_C1_A @F_[C1F[jC1Fi7A @MKC1_MC1HMA


H"#%,$ B1$*2"'8H.C1!."3"..".,C1/40;2'(_8&8+/C1$0Z".C15&64"'8C15&6`"8%0<C1<&8"-&2<4C1"45_8&8+/C
1111111111111111111=2.8%<&8"C1!$&.<H.,8C1!E0=,9C1!G0.;-%0'",:C1!&$$0+'82'(J2.4,;1D
≤1]

H&%E#$H!&E B1$&.<H.C1$&.<:65"C1"#52.67&8"1D
@gFC1`FC1)_A

!#42'K("1d14&#K("
3#h.0+5
,TV>42'K("1Q1h.0+5,>4&#K("1T1V
4
1$'/#-5)6/61BF*2"'81$./%,.&#@')$1F."<28F&.<172-,-1<&8"-&2<1\1"#52.67&8"D
81-5)6/6#)**15&6`"8%0<1Q1SFi7S
9
1-5)6/6#)**1"45_8&8+/1d\1SHMS
:
1-5)6/6#'$&(#)*1"45_8&8+/1d\1SHMS
;
1-5)6/6#'$&(#)*1"45_8&8+/1Q1S_MS

Exercise 11.4

1.1 (a) Politician ( politicianName, isHonest )


{T, F}
(b) Politician ( politicianName, [isHonest] )
{T}
(c) Politician ( politicianName, [isHonest] )
{T, F}
(d)

fCS2eh f<h fB<HS2G[S2CG[S2BG[h


(e) B+81"&+2'$+81"&+J#S2R"&1"#S2NR#,18,+"1S2)*#$+0#,18,+*%&["D"3O.

$%
fCS2eh f<h fB<HS2G[S2CG[S2BG[h
B+81"&+2'$+81"&+J#S2R"&1"#S2NR#,18,+"1S2N)*#$+0#,18,+*%&["D"3OOO.
O
222222 &K0-,-"0//2R#,18,+"12T2+#8"

(f)
Information Modeling and Relational Databases: Answers (odd)–35

3. (a)
@&<42'C1<0$C15%&.4A
=:>"+?%% B1"45H.C1"45H&4"C1E0=C1!0332$",!C1!2'282&*/,3C1!5&(".,41D
9
8

;&%73&#>$#+, B1/$.258H.C1<0$80.C15%&.4&$2/8C15&82"'8H.C1<.+(1D

;!$#%,$ B15&82"'8H.C15&82"'8:65"C1!G&.<,:1D
@2'C10+8A

(""%&-? B15&82"'8H.C1<.+(1D

!
1-5)6/6#)**1E0=1)$1@S&<42'SCS<0$SA
31-5)6/6#)**1E0=1)$1@S<0$SCS5%&.4SA
4
1-5)6/6#)**1E0=1Q1S<0$S
81'$&(#72-,-1E0=1Q1S<0$S
91'$&(#72-,-1E0=1Q1S5%&.4S
:1-5)6/6#)**15&82"'8:65"1Q1S2'S

(b)1 Same as for (a), with documentary warning.

(c)1 This solution minimizes the number of tables by absorbing the Parent subtype. As an extra
exercise, discuss the mapping if a separate Patient table is chosen.

@@@(""%&-? B15"./0'H.C1<.+(1D
!
@6C'A @6C'A @&<42'C1<0$C15%&.4A
@@@;%&7+, B15"./0'H.C12/M45C12/-&82"'8C1!"45H&4"3C1E0=3C1!0332$",4C1!2'282&*/,8C1!5&(".,9,C
1111111111!5&82"'8:65":C1!G&.<,;,D
B C !D @2'C10+8A

@@@;&%73&#>$#+, B1/$.258H.C1<0$80.C15%&.4&$2/8C15&82"'8C1<.+(1D

!
1'$&(#72-,-12/-&82"'81Q1S6S
31-5)6/6#)**12/M451Q1S6S
4
1-5)6/6#)**1E0=1)$1@S&<42'SCS<0$SA
81-5)6/6#)**1E0=1)$1@S<0$SCS5%&.4SA
9
1-5)6/6#)**1E0=1Q1S<0$S
:1-5)6/6#)**12/-&82"'81Q1S6S
;
1-5)6/6#)**15&82"'8:65"1Q1S2'S
B1'$&(#72-,-1E0=1Q1S<0$S
C
1'$&(#72-,-1E0=1Q1S5%&.4S
!D1'$&(#72-,-12/-&82"'81Q1S6S

(d)1 The following solution assumes that personNr may still be used as a global identifier for
Person, while still allowing context-dependent primary identifiers. Notice how the
conceptual pair-exclusion constraint (doctors may not prescribe for themselves) has
become more complicated because of the need to access the global identifiers to perform
the comparison (see qualification 9, and compare this with the simple ! check in (c)).
Information Modeling and Relational Databases: Answers (odd)–36

@6C1'A @6C1'A
;%&7+, B15"./0'H.C12/M45C12/-&82"'81D
B
;
=:>"+?%% B1"45H.C15"./0'H.C1"45H&4"C1E0=C1!0332$",!C1!2'282&*/,3C1!5&(".,41D
9 @&<42'C1<0$C15%&.4A
8

;&%73&#>$#+, B1/$.258H.C1<0$80. C15%&.4&$2/8C15&82"'8CC1<.+(1D


C

;!$#%,$ B15&82"'8H.C15"./0'H.C15&82"'8:65"C1!G&.<,:1D
@2'C10+8A

(""%&-? B15&82"'8H.C1<.+(1D

!
1-5)6/6#)**1E0=1)$1@S&<42'SCS<0$SA
31-5)6/6#)**1E0=1)$1@S<0$SCS5%&.4SA
4
1-5)6/6#)**1E0=1Q1S<0$S
81'$&(#72-,-1E0=1Q1S<0$S
91'$&(#72-,-1E0=1Q1S5%&.4S
:1-5)6/6#)**15&82"'8:65"1Q1S2'S
;
1-5.+/&(#72-,-12/M451Q1S6S
B
1-5.+/&(#72-,-12/-&82"'81Q1S6S
C1BM45*06"">5"./0'H.172-,-1"45H.1Q1<0$80.D1d\

111B-&82"'8>5"./0'H.172-,-15&82"'8H.1Q15&82"'8D

5. (a) This assumes departure time might not be known. If it must be known, add a mandatory
constraint and remove the independence setting for FlightDeparture.

Xe3*R/+H"=,#+8#"2rY

e3*R/+ L*#=%#+
'(&#. '(>%1".
1"=,#+$

<*-"
'/-.
%>>8##"12,+

(b)
e3*R/+ L*#=%#+
'(&#. '(>%1".
1"=,#+$2)#%-

<*-"
'/-.
1"=,#+"12,+

(c) Flight ( FlightNr, origin, [departureTime] )


Information Modeling and Relational Databases: Answers (odd)–37

Exercise 12.1

1. (a) Uses ( student, computer ) Owns ( student, computer )


Ann P2 Fred P2
Fred P2 Sue P1
Fred Mac Tom Mac
Sue P3

(b) (Uses ! Owns) [student] → student


Ann
aliter: Uses [student] ! Owns [student] Fred
Sue
Tom
Note: To save space, later results are shown on one line with the column name omitted
(c) (Uses − Owns) [student] → { Ann, Fred, Sue }
(d) Uses [student] − Owns [student] → { Ann }
(e) Owns [student] − Uses [student] → { Tom }
(f) (Owns − Uses) [student] → { Sue, Tom }
(g) (Uses " Owns) [student] → { Fred }
(h) Uses [student] " Owns [student] → { Fred, Sue }
(i) Uses [computer] − Owns [computer] → { P3 }
(j) Owns [computer] − Uses [computer] → { P1 }

3. (a) Subject where subjCode = 'CS113'


(b) (Student where gender = 'M' and birthYr > 1960)
[studentNr, studentName, degree]
(c) (Student # Result) where studentName = 'Brown T' [subjCode]
aliter: ((Student where studentName = 'Brown T') [studentNr]
# Result) [subjCode]
aliter: ((Student where studentName = 'Brown T') # Result) [subjCode]
Note: From now on we normally show only one solution, favoring joins first if convenient,
and omitting optional intermediate projections.
(d) (Student # Result) where rating = 7
[studentNr,studentName]
(e) (Student # Subject # Result)
where title = 'Logic' and rating = 5
[studentNr, studentName]
(f) ((Result [studentNr, subjCode] ÷ Subject [subjCode]) # Student)
[studentNr, degree]
(g) (Student where degree = 'BSc') [studentNr, studentName, gender]
!
((Result where subjCode = 'PD102' and rating = 7) # Student)
[studentNr, studentName, gender]
(h) (Student # Subject # Result)
where gender = 'M' and birthYr < 1970
and rating >= 5 and title = 'Databases'
[studentNr, studentName, birthYr]
Information Modeling and Relational Databases: Answers (odd)–38

5. (a)
;&+2%3$1111B15.0E"$8F0<"C1=+<("81D

9+&/1111111B1"45H&4"C15.0E"$8F0<"1D

1111111@`C1JA
=:>"+?%%B1"45H&4"C1("'<".C1/&*&.61D

(b) (Work # Employee)


where gender = 'F' and (salary > 25000 or projectCode = '5GIS')
[empName, salary]

(c) (Employee #!Work) [empName, gender, projectCode]


÷
Project where budget >= 100000 [projectCode]

7. (a) A " B = A − (A − B) { or B − (B −A) }


(b) A # B = (A " B) where A.y = B.y [A.x, A.y, B.z]
(c) A − B = A[x] − ((A[x] ×B) −A)[x]

9. (a) (Invoice # LineItem # Item)


where unitPrice < listPrice [customerNr]

(Invoice # LineItem # Item)
where category = ‘WP’ [customerNr]
Note: It is wrong to simply add: “and category <> ‘WP’”.

(b) ((Invoice # LineItem) [customerNr, itemCode]


÷
(Item where category = ‘SS’) [itemCode]
#
Customer) [customerName]

(c) (Invoice # LineItem) [customerNr, itemCode]


÷
(Item where category = ‘WP’) [itemCode]

(Invoice # LineItem # Item)
where category = ‘DB’ [customerNr]

(d) (LineItem # Item) where category = ‘SS’ [invoiceNr]


"
(LineItem # Item) where category = ‘WP’ [invoiceNr]
# Invoice [customerNr]
Information Modeling and Relational Databases: Answers (odd)–39

Exercise 12.4

1. (a) Illegal SQL-89, SQL-92, SQL:1999, and SQL:2003 (but legal in some commercial dialects)
(b)1 Legal in all
(c)1 Legal as a delimited identifier in SQL-92, SQL:1999 and SQL:2003
(d)1 Illegal in all (starting digit)
(e)1 Illegal in all (embedded space)
(f)1 Legal as a delimited identifier in SQL-92, SQL:1999, and SLQ:2003
(g)1 Legal in all
(h)1 Illegal in all (but legal in some commercial dialects, which allow “$”)
(i)1 Illegal in all (parentheses)
(j)1 Illegal in all (reserved word)
(k)1 Illegal in SQL-89 (too long) but legal in SQL-92, SQL:1999, and SLQ:2003
(l)1 Legal in SQL:1999 and SLQ:2003 (where “count” is no longer a reserved word)

Exercise 12.5

1. (a) &(0(,)(I"#@("%$'(,&*&$'$#&( (
(b) &(0(,)(G("%$'(,&*&$'$#&
(c) &(0(,)(I"#@D(8/'</+"&"/#("%$'(,&*&$'$#&(
(d) &(0(,)(I"#@D($J&;*("%$'(,&*&$'$#&(
(e) &(0(,)(8!&)!.,)(8/'</+"&"/#("%$'(,&*&$'$#&
(f) &(0(,)(I"#@("%$'(,&*&$'$#&(
( ( 7*(%((8/'</+"&"/#(K(L+&;-8&-;$@L(
(g) &(0(,)(I"#@("%$'(,&*&$'$#&(( (
7*(%((8/'</+"&"/#(K(L+"'<0$L(
((((+.8($J&;*(K(LML(
1)61 &(0(,)(I"#@D8/'</+"&"/#(
"%$'(,&*&$'$#&((
( 7*(%(($J&;*(K(LML(
(i) &(0(,)(I"#@("%$'(,&*&$'$#&(( ( ( (j)(( &(0(,)(I"#@D(8/'</+"&"/#(
7*(%(($J&;*(K(LNL((( ( ( ( ( "%$'(,&*&$'$#&((
$%8(%#45(I"#@( ( ( ( ( ( ( $%8(%#45(8/'</+"&"/#(
(k) &(0(,)(I"#@D(8/'</+"&"/#("%$'(,&*&$'$#&((
$%8(%#45(8/'</+"&"/#(8(&,D(I"#@(+&,# # -- asc may be omitted since it is implied
(l) &(0(,)(G("%$'(,&*&$'$#&((
$%8(%#45($J&;*(8(&,D(8/'</+"&"/#(+&,D(I"#@(8(&,(
(m) &(0(,)(I"#@("%$'(,&*&$'$#&((
7*(%((8/'</+"&"/#(OH(L+&;-8&-;$@L(+.8($J&;*(K(LNL((
$%8(%#45(I"#@(
(n) &(0(,)(I"#@("%$'(,&*&$'$#&((
7*(%((8/'</+"&"/#(K(L+&;-8&-;$@L(+.8($J&;*(K(LML((
((((((($%(8/'</+"&"/#(K(L+"'<0$L((
$%8(%#45(I"#@(8(&,(
(o) &(0(,)(I"#@D(8/'</+"&"/#("%$'(,&*&$'$#&((
7*(%((I"#@(OH(L$J"&L((
(((+.8(18/'</+"&"/#(K(L+&;-8&-;$@L(+.8($J&;*(K(LML((
((($%(8/'</+"&"/#(K(L+"'<0$L6((
$%8(%#45(8/'</+"&"/#(8(&,D(I"#@(8(&, -- the parentheses in this query are needed
Information Modeling and Relational Databases: Answers (odd)–40

Exercise 12.6

1. (a) &(0(,)(+&-@$#&N;D(+&-@$#&N*'$D(@$P;$$D(.";&)M;("%$'(,&-@$#&((
$%8(%#45(@$P;$$D(.";&)M;(
(b) &(0(,)##+&-@$#&N;D(+-.Q>/@$((
"%$'(((R$+-0&(.+)2%+0#9$!.(,&-@$#&((
7*(%((+&-@$#&N*'$(K(S,'"&)(TU(
Note: If the newer join syntax introduced in SQL-92 is not supported, use older syntax,
e.g.,
&(0(,)##R$+-0&V+&-@$#&N;D(+-.Q>/@$(
"%$'((((R$+-0&(9$!.(,&-@$#&((
############$.(R$+-0&V+&-@$#&N;(K(,&-@$#&V+&-@$#&N;(
7*(%(((+&-@$#&N*'$(K(S,'"&)(TU(
or
&(0(,)##R$+-0&V+&-@$#&N;D(+-.Q>/@$(
"%$'(((R$+-0&D(,&-@$#&((
7*(%((R$+-0&V+&-@$#&N;(K(,&-@$#&V+&-@$#&N;(+.8((+&-@$#&N*'$(K(S,'"&)(TU(
Here, “Result.studentNr” in the select-list may be replaced by “Student.studentNr” but not
just “studentNr”. Later solutions assume the SQL-92 join syntax is supported.
(c) &(0(,)((+&-@$#&N;D(+&-@$#&N*'$D(P$#@$;((
"%$'(((,&-@$#&(.+)2%+0#9$!.(R$+-0&((
7*(%((+-.Q>/@$(K(L>,??CL(
(d) &(0(,)((&"&0$("%$'(,-.Q$8&(.+)2%+0#9$!.(R$+-0&((
7*(%((+&-@$#&N;(K(WXC( ( -- assuming studentNr has a numeric data type
(e) &(0(,)(+&-@$#&N;D(+&-@$#&N*'$D(@$P;$$((
"%$'((,&-@$#&(.+)2%+0#9$!.(,-.Q$8&(.+)2%+0#9$!.(R$+-0&((
7*(%((P$#@$;(K(LYL(+.8(;*&"#P(K(Z(+.8(&"&0$(K(L!/P"8L(
$%8(%#45(+&-@$#&N*'$(
(f) &(0(,)##8!&)!.,)(+-.Q>/@$D(8;$@"&((
"%$'(((,&-@$#&(.+)2%+0#9$!.(,-.Q$8&(.+)2%+0#9$!.(R$+-0&((
7*(%((P$#@$;(K(LYL(+.8(@$P;$$(K(LB,8L(+.8(;*&"#P(K([((
$%8(%#45(8;$@"&(8(&,D(+-.Q>/@$(
(g) &(0(,)(+-.Q>/@$D(&"&0$D(;*&"#P(
"%$'((,-.Q$8&(.+)2%+0#0(")#9$!.(R$+-0&(

Exercise 12.7

1. (a) &(0(,)(&"&0$("%$'(>/'<!*#P-*P$(( ( ( ( (b)(( &(0(,)(&"&0$("%$'(>/'<!*#P-*P$((


7*(%((;$0$*+$M;(!.(1?\Z\D?\[ZD?\[\6( ( ( ( ( 7*(%((;$0$*+$M;(4()7((.(?\Z\(+.8(?\[\(
-- Logo and SQL absent because of nulls
(c) &(0(,)(&"&0$("%$'(>/'<!*#P-*P$(( ( ( ( (d)(( &(0(,)(G("%$'(>/'<!*#P-*P$((
7*(%((;$0$*+$M;(!&#.200( ( ( ( ( ( ( ( ( 7*(%((&"&0$(0!-((L]//@/^L(
(e) &(0(,)(&"&0$("%$'(>/'<!*#P-*P$(( ( ( ( (f)((( &(0(,)(G("%$'(>/'<!*#P-*P$(
7*(%((&"&0$(0!-((L^_!L(( ( ( ( ( ( ( ( ( 7*(%((&"&0$(0!-((L^:*+8*0^L(
(g) &(0(,)(&"&0$("%$'(>/'<!*#P-*P$(( ( ( ( (h)(( &(0(,)(&"&0$("%$'(>/'<!*#P-*P$((
7*(%((&"&0$(0!-((LFFFFFL(( `(Z(F(a( ( ( ( ( ( ( 7*(%((&"&0$(0!-((LF/^L(
Information Modeling and Relational Databases: Answers (odd)–41

1.1 (i) &(0(,)(&"&0$("%$'(>/'<!*#P-*P$((


7*(%((&"&0$(0!-((L^_^L($%(&"&0$(0!-((L^/^L(
(j) &(0(,)("("%$'(>/'<!*#P-*P$((
7*(%((&"&0$(.$)#0!-((L:^L((
(((+.8(;$0$*+$M;(4()7((.(?\Xb(+.8(?\[W(
(k) &(0(,)(&"&0$("%$'(>/'<!*#P-*P$((
7*(%((&"&0$(0!-((LFFFFF*L($%(&"&0$(0!-((LFFFF*FL -- 5 then 4,1 underscore
(((#$%((&"&0$(0!-((LFFF_!L( -- 3 underscores

Exercise 12.8

1. (a) &(0(,)(<$;+/#("%$'(E*&$;(7*(%((P$#@$;(K(LYL($%(c$"P)&(H(Xb(
(b) &(0(,)(<$;+/#("%$'(E*&$;(7*(%(#P$#@$;(K(LYL((
(( 2.!$.((
&(0(,)(<$;+/#("%$'(E*&+(7*(%((d//@N*'$(K(L<$*+L(
aliter: &(0(,)(<$;+/#("%$'(E*&$;((
7*(%((P$#@$;(K(LYL($%((
( <$;+/#(!.(1&(0(,)(<$;+/#("%$'(E*&+((
( ( ( ( ( ( 7*(%((d//@N*'$(K(L<$*+L6(
aliter: &(0(,)#8!&)!.,)(<$;+/#(
"%$'(E*&$;(.+)2%+0#9$!.(E*&+(
7*(%(((P$#@$;(K(LYL($%(d//@N*'$(K(L<$*+L(
(c) &(0(,)(<$;+/#("%$'(E*&$;(7*(%((P$#@$;(K(LeL(+.8(c$"P)&(H(Xb(
(d) &(0(,)(<$;+/#("%$'(E*&$;(7*(%((P$#@$;(K(LeL(
!.)(%&(,)(
&(0(,)(<$;+/#("%$'(E*&+(7*(%((d//@N*'$(K(L</&*&/L(
aliter: &(0(,)(<$;+/#("%$'(E*&$;((
#7*(%((P$#@$;(K(LeL(+.8(<$;+/#(!.(((
1&(0(,)(<$;+/#("%$'(E*&+((
(7*(%((d//@N*'$(K(L</&*&/L6(
(e) &(0(,)(<$;+/#("%$'(E*&$;(7*(%((c$"P)&(H(Xb(
(/,(3)(
&(0(,)(<$;+/#("%$'(E*&+(7*(%(#d//@N*'$(K(L.$$dL(
aliter: &(0(,)(<$;+/#("%$'(E*&$;((
#7*(%((c$"P)&(H(Xb(+.8(<$;+/#(.$)#!.(
((( 1&(0(,)(<$;+/#("%$'(E*&+(7*(%(#d//@N*'$(K(L.$$dL6(
(f) &(0(,)(#V<$;+/#D($V<$;+/#((
"%$'(E*&$;(+&(#D(E*&$;(+&($(
7*(%((#Vc$"P)&(K($Vc$"P)&(+.8(#VP$#@$;(O($VP$#@$;(
Note: This is the neatest way to avoid showing each pair in two different orders. Here the
female of each pair appears on the left. A correct but longer solution is to order
members of each pair alphabetically. For example:

&(0(,)(#V<$;+/#D($V<$;+/#("%$'(E*&$;(+&(#D(E*&$;(+&($(
Information Modeling and Relational Databases: Answers (odd)–42

7*(%((#Vc$"P)&(K($Vc$"P)&(
((((+.8(#VP$#@$;(OH($VP$#@$;((
((((+.8(#V<$;+/#(O(BV<$;+/#(
(g) &(0(,)#8!&)!.,)(<$;+/#("%$'(E*&+((
7*(%((d//@N*'$(!.((
1&(0(,)(d//@N*'$("%$'(e//@((
(#7*(%((d//@>0*++(K(L7$P$&*.0$L6(
(h) &(0(,)#8!&)!.,)(<$;+/#D(c$"P)&(
"%$'(E*&$;(.+)2%+0#9$!.(E*&+(.+)2%+0#9$!.((e//@((
7*(%((P$#@$;(K(LYL(+.8(d//@>0*++(K(L'$*&L(
aliter: &(0(,)(<$;+/#D(c$"P)&("%$'(E*&$;((
7*(%((P$#@$;(K(LYL(+.8(<$;+/#(!.((
1&(0(,)(<$;+/#("%$'(E*&+((
(7*(%((d//@N*'$(!.#(
1&(0(,)(d//@N*'$("%$'(e//@((
(7*(%((d//@>0*++(K(L'$*&L66(
(i) &(0(,)#8!&)!.,)(<$;+/#("%$'(E*&+((
7*(%((d//@N*'$(.$)#!.((1&(0(,)(d//@N*'$(d;/'(e//@((
(7*(%((d//@>0*++(K(L'$*&L6(
(j) &(0(,)(<$;+/#("%$'(E*&$;((
7*(%((<$;+/#(.$)#!.#(
1&(0(,)(<$;+/#("%$'(E*&+(7*(%((d//@N*'$(!.#(
1&(0(,)(d//@N*'$("%$'(e//@(7*(%((d//@>0*++(K(L'$*&L66(
(k) &(0(,)(L7$P$&*;"*#5(L(+&($*&$;9=<$D(<$;+/#D(c$"P)&D(P$#@$;("%$'(E*&$;((
7*(%((<$;+/#(.$)#!.#(
1&(0(,)(<$;+/#("%$'(E*&+(7*(%((d//@N*'$(!.#(
1&(0(,)(d//@N*'$("%$'(e//@(7*(%((d//@>0*++(K(L'$*&L66((
2.!$.#(
&(0(,)(L'$*&$*&$;5(L#+&($*&$;9=<$D(<$;+/#D(c$"P)&D(P$#@$;("%$'(E*&$;((
7*(%((<$;+/#(!.#(
1&(0(,)(<$;+/#("%$'(E*&+(7*(%((d//@N*'$(!.#(
1&(0(,)(d//@N*'$("%$'(e//@(7*(%((d//@>0*++(K(L'$*&L66((
$%8(%#45($*&$;9=<$(8(&,D(P$#@$;D(c$"P)&D(<$;+/#(
Note: From SQL-92 onwards, the list “person, weight, gender” may be replaced by
“Eater.*”.

Exercise 12.9

1. (a) &(0(,)#,$2.)1G6("%$'(E*&$;((
7*(%((P$#@$;(K(SYU(+.8(c$"P)&(H(?bb(
(b) &(0(,)#,$2.)18!&)!.,)(c$"P)&6("%$'(E*&$;
(c) &(0(,)#&2'1c$"P)&6("%$'(E*&$;((
7*(%((P$#@$;(K(SYU(

(d) &(0(,)#+611c$"P)&6("%$'(E*&$;(7*(%((P$#@$;(K(SeU(
Information Modeling and Relational Databases: Answers (odd)–43

(e) &(0(,)#'+/1c$"P)&6("%$'(E*&$;((
7*(%((<$;+/#(!.#
# 1&(0(,)(<$;+/#("%$'(E*&+((
( ( ( (7*(%((d//@N*'$(K(L.$$dL6(
(f) &(0(,)(<$;+/#("%$'(E*&$;(( ( ( ( ( aliter:! &(0(,)(<$;+/#("%$'(E*&$;((
7*(%((P$#@$;(K(LeL(+.8(c$"P)&(O((( ( ( ( ( ( 7*(%((P$#@$;(K(LeL(+.8(c$"P)&(O(+00(
1&(0(,)#'!.1c$"P)&6("%$'(E*&$;(( ( ( ( ( ( 1&(0(,)(c$"P)&("%$'(E*&$;((
(7*(%((P$#@$;(K(LYL6( ( ( ( ( ( ( ( ( (7*(%((P$#@$;(K(LYL6(
(g) &(0(,)(<$;+/#D(c$"P)&("%$'(E*&$;(( (
7*(%((P$#@$;(K(LeL(+.8(c$"P)&(HK((
1&(0(,)#'!.1c$"P)&6("%$'(E*&$;((
(7*(%((P$#@$;(K(LYL6 (

aliter: &(0(,)#<$;+/#D(c$"P)&("%$'(E*&$;((
7*(%((P$#@$;(K(LeL(+.8(c$"P)&(HK(&$'(((
1&(0(,)(c$"P)&("%$'(E*&$;(7*(%((P$#@$;(K(LYL6(

3. Note: In this database the nationalities of authors from America, Australia and New
Zealand are stored as ‘American’, ‘Aussie’, and ‘Kiwi’, respectively.
(a) &(0(,)(*-&)/;N*'$("%$'#2-&)/;((
7*(%((P$#@$;(K(LYL(+.8(#*&"/#*0"&=(K(L2-++"$L(
(b) &(0(,)(&"&0$("%$'(B//I((
7*(%((=;:-.0"+)$@(4()7((.(?\Wf(+.8(?\WX((
(( ( $%8(%#45(&"&0$((
If the SQL dialect uses the ASCII collating sequence (which orders lower case letters after
upper case letters) and the system is in case-sensitive mode, 'dBaseIII' is placed last.
(c) &(0(,)(G(d;/'(B//I((
7*(%((&"&0$(0!-((L^,g!^L((
$%8(%#45(=;:-.0"+)$@(8(&,(
(d) &(0(,)(*-&)/;N*'$("%$'(h;"&&$#B=((
7*(%(("+.#(!.#(
1&(0(,)("+.#("%$'(B//I((
(7*(%((&"&0$(K(L4*&*.*+$+L(+.8(=;:-.0"+)$@(K(?\Wb6 (

aliter: &(0(,)((*-&)/;N*'$("%$'(B//I(.+)2%+0#9$!.(h;"&&$#B=((
7*(%((&"&0$(K(L4*&*.*+$+L(+.8(=;:-.0"+)$@(K(?\Wb(
The previous alternative solutions use the subquery approach and the join approach. The
remaining solutions use the subquery approach. As an extra exercise, formulate the
equivalent solutions using joins.
(e) &(0(,)("+.#D(&"&0$("%$'(B//I(
( ( 7*(%(("+.#(!.#(
1&(0(,)("+.#("%$'(h;"&&$#B=((
(7*(%((*-&)/;N*'$(!.#(
((1&(0(,)(*-&)/;N*'$("%$'(2-&)/;(7*(%((#*&"/#*0"&=(K(L2-++"$L66(
(f) &(0(,)(*-&)/;N*'$D(#*&"/#*0"&=("%$'(2-&)/;((
7*(%((*-&)/;N*'$(!.#(
Information Modeling and Relational Databases: Answers (odd)–44

(( ( ((((((1&(0(,)(*-&)/;N*'$("%$'(h;"&&$#B=((
( ( (((((((7*(%(("+.#(!.#(
((((((1&(0(,)("+.#("%$'(B//I((
(######7*(%((&"&0$(K(L%#d/;'*&"8+L(+.8(<-.0"+)$;(K(Li*00L(+.8(=;:-.0"+)$@(K(?\WX66(
(g) &(0(,)(L2-+&;*0"*#('*0$5(L(+&(<$;+/#9=<$D(*-&)/;N*'$(
## "%$'(2-&)/;((
7*(%((P$#@$;(K(LYL(+.8(#*&"/#*0"&=(K(L2-++"$L((
2.!$.#(
&(0(,)(L2'$;"8*#(d$'*0$5(L(+&(<$;+/#9=<$D(*-&)/;N*'$((
"%$'(2-&)/;((
7*(%((P$#@$;(K(LeL(+.8(#*&"/#*0"&=(K(L2'$;"8*#L((
$%8(%#45(<$;+/#9=<$(8(&,(

Exercise 12.10

1. (a) &(0(,)(P$#@$;D(,$2.)1G6("%$'(2-&)/;(
1%$23#45(P$#@$;(
(b) &(0(,)(P$#@$;D(#*&"/#*0"&=D(,$2.)1G6(+&(#;2-&)/;+((
"%$'(2-&)/;((
1%$23#45(P$#@$;D(#*&"/#*0"&=((
$%8(%#45(#;2-&)/;+(8(&,(
(c) &(0(,)(<-.0"+)$;D(&2'1#;>/<"$+6("%$'(B//I((
7*(%((=;:-.0"+)$@(H(?\Wb((
1%$23#45(<-.0"+)$;
(d) &(0(,)(<-.0"+)$;D('!.1=;:-.0"+)$@6( "%$'(B//I((
1%$23#45(<-.0"+)$;((
*+6!.1(+611#;>/<"$+6(H(A(
(e) &(0(,)("+.#D(,$2.)1G6("%$'(h;"&&$#B=((
7*(%(("+.#(!.((
1&(0(,)("+.#("%$'(B//I(7*(%((=;:-.0"+)$@(O(?\WX6((
1%$23#45("+.#(
(( *+6!.1(,$2.)1G6(H(?(
(f) &(0(,)(#*&"/#*0"&=D(,$2.)1G6("%$'(2-&)/;((
7*(%((P$#@$;(K(LYL(+.8(*-&)/;N*'$(!.#(
1&(0(,)(*-&)/;N*'$("%$'(h;"&&$#B=((
(7*(%(("+.#(!.((
1&(0(,)("+.#("%$'(B//I((
(7*(%((<-.0"+)$;(!.(1Li*00LDL:/++-'L666((
1%$23#45(#*&"/#*0"&=((
*+6!.1(,$2.)1G6(HK((
(1&(0(,)(#;>/<"$+("%$'(B//I((
((7*(%(("+.#(K(LfffL6(
Information Modeling and Relational Databases: Answers (odd)–45

Exercise 12.11

1. (a) &(0(,)(<-<"0N;D(+-;#*'$D(d";+&#*'$(
( ( "%$'((:-<"0(
( ( 7*(%(("j(K(
( ( ( 1&(0(,)#'+/1"j6("%$'(:-<"06(
(b) &(0(,)(<-<"0N;D(+-;#*'$D(d";+&#*'$(
( ( "%$'((:-<"0(+&(k(
( ( 7*(%(("j(K(
( ( ( 1&(0(,)#'+/1"j6("%$'(:-<"0(
( ( ( (7*(%((P$#@$;(K(kVP$#@$;6(
1861 &(0(,)(YV<-<"0N;D(YV+-;#*'$V(YVd";+&#*'$D(eV<-<"0N;D(eV+-;#*'$D(eVd";+&#*'$(
( ( "%$'((:-<"0(+&(YD(:-<"0(+&(e(
( ( 7*(%((YVP$#@$;(K(SYU(+.8(eVP$#@$;(K(SeU(
( ( ((((+.8(YV"j(K(eV"j(

3. (a) &(0(,)(+&-@$#&N;D(+&-@$#&N*'$(
( ( "%$'((,&-@$#&(
( ( 7*(%((+&-@$#&N;(.$)#!.(
( ( ( 1&(0(,)(+&-@$#&N;("%$'(R$+-0&(
( ( ( (7*(%((;*&"#P(K([6(
(b) &(0(,)(+&-@$#&N;D(+&-@$#&N*'$(
( ( "%$'((,&-@$#&(.+)2%+0#9$!.(R$+-0&(
( ( 1%$23#45(+&-@$#&N;D(+&-@$#&N*'$(
( ( *+6!.1#'+/1;*&"#P6(O([(
Note: The following query is wrong, since it also returns those get both a 7 and a non-7 rating.
&(0(,)(+&-@$#&N;D(+&-@$#&N*'$(
( ( "%$'((,&-@$#&(.+)2%+0#9$!.(R$+-0&(
( ( 7*(%((;*&"#P(OH([(

Exercise 13.3

1. ,%(+)(#)+40((Y/7"$(1(
((( (('/7"$>/@$( ,*+%1f6( .$)#.200###3%!'+%5#-(5D(
((((( ((&"&0$( ( ( 6+%*+%1Ab6( .$)#.200D(
((((( ((8*&$P/;=( ( ,*+%1A6( .$)#.200###,*(,-(18*&$P/;=(!.(1L]LD(L:]LD(LYLD(LRL66(6l(
,%(+)(#)+40((m"@$/9*<$(1(
((( (('/7"$>/@$( ,*+%1f6( .$)#.200(((%("(%(.,(&(Y/7"$D(
((((( ((8/<=N;( ( 8(,1A6( .$)#.200D(
((((( ((<-;8)*+$4*&$( 8+)(# ( .$)#.200D(
((((( ((+&*&-+( ( ,*+%1A6( .$)#.200###,*(,-(1+&*&-+(!.(1S]//@UD(S_nUD(S://;D(SkU66D(
( ((8/''$#&( ( 6+%,*+%1Ab6D(
( ((c;"&&$#_dd( ( ,*+%# # ,*(,-(1(c;"&&$#_dd("#(1SMUD(SNU6D(
3%!'+%5#-(5(1'/7"$>/@$D(8/<=N;6D((
,*(,-(1+&*&-+(OH(SkU(+.8(8/''$#&(!&#.200#+.8#c;"&&$#_dd#!&#.200:#$%((
((1+&*&-+(K(SkU(+.8(8/''$#&(!&#.$)#.200#+.8#c;"&&$#_dd#!&#.$)#.2006(6l(
Information Modeling and Relational Databases: Answers (odd)–46

,%(+)(#)+40((>-+&/'$;(1(
((( ((8*;@N;( ( ( &'+00!.)( ( .$)#.200###3%!'+%5#-(5D(
((((( ((8-+&/'$;N*'$( ( 6+%,*+%1Ab6( .$)#.200D(
((((( ((*@@;$++( ( ( 6+%,*+%1Cb6( .$)#.200D(
2.!;2((18-+&/'$;N*'$D(*@@;$++6(6l(
# ,%(+)(#)+40((!/*#(1(
( ((0/*#N;( ( &'+00!.)( .$)#.200###3%!'+%5#-(5D(
((((( (("++-$4*&$(( 8+)(# ( .$)#.200D(
((((( ((8*;@N;( ( &'+00!.)( .$)#.200###%("(%(.,(&(>-+&/'$;(6l(
# ,%(+)(#)+40((!/*#%&$'(1(
((( ((0/*#N;( ( &'+00!.)( .$)#.200####%("(%(.,(&(!/*#D(
((((( (('/7"$>/@$( ,*+%1f6( .$)#.200D(
((((( ((8/<=N;( ( &'+00!.)( .$)#.200D(
( ((8/+&(( ( 8(,1ZDA6( .$)#.200D( (
((((( ((;$&-;#4*&$(8+)(D(
3%!'+%5#-(5(10/*#N;D('/7"$>/@$D(8/<=N;6D(
"$%(!1.#-(5(1'/7"$>/@$D(8/<=N;6(%("(%(.,(&(m"@$/9*<$(6l(
( ,%(+)(#+&&(%)!$.($*8)F0/*#F)*+F*F0/*#F"&$'(
( ( ,*(,-1(.$)#(/!&)&(
( ( ( ( 1&(0(,)(G("%$'(!/*#(
( ( ( ( (7*(%((0/*#N;(.$)#!.(
( ( ( ( ( 1&(0(,)(0/*#N;("%$'(!/*#%&$'66(6(

3. (a) ,%(+)(#)+40(#9$8)#"8"*#(1#
$'<N;(( !.)## # # # .$)#.200## 3%!'+%5#-(5<#
d";+&N*'$## 6+%,*+%=>?:##.$)#.200<#
0*+&N*'$## 6+%,*+%=@?:##.$)#.200<#
+-<$;7"+/;## !.)##
# "$%(!1.#-(5#%("(%(.,(&#9$8)#"8"*#1$'<N;66#
,%(+)(#)+40(#2++$'.0=(1(
*++$'.0=>/@$(( ,*+%=A?:## .$)#.200## 3%!'+%5#-(5<#
8/'<0$J"&=N;## &'+00!.)## .$)#.200#
# ,*(,-#=,$'30(/!)5B%#4()7((.#b#+.8#W6D(
<*;&_d(( ( ,*+%=A?:#
# "$%(!1.#-(5#%("(%(.,(&#2++$'.0=1*++$'.0=>/@$6D#
"+9/<!$7$0(( ( ,*+%## # .$)#.200##
# ,*(,-#="+9/<!$7$0#!.#1LMLD(LNL66D(( -- see answer to 3(c)
)*+R$</;&## # ,*+%## # .$)#.200##
# ,*(,-#=)*+;$</;&#!.#1LMLD(LNL666(
,%(+)(#)+40(#>/'<$&$#8$(1(
$'<N;(( ( !.)## # # .$)#.200#
# "$%(!1.#-(5#%("(%(.,(&#9$8)#"8"*#1$'<N;6D(
*++$'.0=## ,*+%=A?:## .$)#.200#
# "$%(!1.#-(5#%("(%(.,(&#2++$'.0=1*++$'.0=>/@$6D(
8$;&"d"8*&"/#R$d## 6+%,*+%=>?:#2.!;2(<#
# 3%!'+%5#-(51$'<N;D(*++$'.0=66(
Information Modeling and Relational Databases: Answers (odd)–47

Other possibilities exist. For example, constraints can be named for convenience. Also,
variations between SQL implementations may introduce other features. For example, it
might be wise to make “assembly” a delimited identifier in SQL Server to avoid confusion
with the .NET integration features.
(b)1 The foreign key references in the “create table” statements impose some ordering, so the
Competence table must be created after the Technician and the Assembly tables. For similar
reasons, the Technician and Assembly tables cannot be dropped while the foreign key
references exist in the Competence table. One way around the ordering constraints on table
creation is to omit the foreign key references in the “create table” statement and add them
later using “alter table…”.
(c)1 The self-references in the Technician and Assembly tables give clues to the existence of
hierarchies. In the case of a technician at the top of a hierarchy (there could be more than
one hierarchy) the “supervisor” reference will be null. However, this value could also be
null simply because we don’t currently know who supervises a particular technician. The
Assembly hierarchy provides an explicit “isTopLevel” flag to indicate a node at the top of a
hierarchy. It would be wise to include an additional check to ensure that “partOf" is null if
“isTopLevel” is ‘Y’.

5. (a) This is not a correct statement. Although ordinary views can be visualized as tables (and
queried in much the same way), no table actually exists. A queries on a view is integrated
with the view’s stored query definition and the combination is applied to base tables. Unlike
ordinary views, materialized views are actually stored.
(b) This is not a correct statement. A view definition may reference another view (sometimes
referred to as a “nested” view. Some SQL dialects also allow recursive views.
(d)1 This is a correct statement. However the amount of data storage required to hold a view
definition is miniscule compared with the typical storage required for data in the base
tables.
(e)1 This is not a correct statement. Views are not materialized unless they are explicitly
specified as such.
(f)1 This is a correct statement. Database systems limit the updating of views to updates that are
“sensible” in the context of the view definition. It may be impossible for an automated
system to work out the intent of an update when the view has been constructed from, say, a
join between base tables.

Exercise 13.4

1. We need at least two triggers to reproduce the functionality of the “references” clause: one at
the referencing end and one at the referenced end. The examples here are for SQL Server. There
may be minor differences for other dialects of SQL.

oo(8)$8I(&)*&(*(>/'<$&$#8$(;$d$;+(&/(*(7*0"@(9$8)#"8"*#(
( ,%(+)(#)%!11(%(>/'<$&$#8$i*+9$8)#"8"*#(
$.(>/'<$&$#8$(
+")(%#!.&(%)<#238+)(#
+&#
!"#(/!&)&(
Information Modeling and Relational Databases: Answers (odd)–48

( 1&(0(,)(G(
( "%$'(%#+$;&$@(+&("(0(")#$2)(%#9$!.(9$8)#"8"*#(+&(&(
( $.("V$'<N;(K(&V$'<N;(
( 7*(%((&V$'<N;(!&#.2006(
4(1!.#
( %+!&(%%$%1L>/'<$&$#8$('-+&(;$d$;(&/(7*0"@(&$8)#"8"*#LD(?XD(?6(
( %$004+,-#)%+.&+,)!$.#
(.8#
#
oo("d(*(>/'<$&$#8$(;$d$;+(&/(*(9$8)#"8"*#(c$(@/(N_9(c*#&((
oo(&/(@$0$&$(&)$(9$8)#"8"*#(/;(8)*#P$(&)$(I$=(8/0-'#(
,%(+)(#)%!11(%(9$8)#"8"*#i*+>/'<$&$#8$(
$.(9$8)#"8"*#(
+")(%#8(0()(<#238+)(#
+&#
!"#(/!&)&#
( 1&(0(,)(G(
( "%$'(4$0$&$@(+&(@(9$!.(>/'<$&$#8$(+&(8(
( $.(@V$'<N;(K(8V$'<N;((
( 0(")#$2)(%#9$!.(%#+$;&$@(*+("(
( $.(@V$'<N;(K("V$'<N;(
( 7*(%(("V$'<N;(!&#.2006(
( oo((
4(1!.#
( %+!&(%%$%1L9$8)#"8"*#("+(;$d$;$#8$@5(Y/@"d"8*&"/#(d*"0$@LD(?XD(?6(
( %$004+,-#)%+.&+,)!$.#
(.8#

3.!!,%(+)(#)%!11(%(>/'<0$J"&=2@Q-+&'$#&((
$.(2++$'.0=(
+")(%#238+)(#
+&#
!"#(/!&)&#
( 1&(0(,)(G(
( "%$'(%#+$;&$@(+&("(9$!.(4$0$&$@(+&(@(
( $.("V*++$'.0=>/@$(K(@V*++$'.0=>/@$(
( 7*(%((+4&1"V8/'<0$J"&=N;(o(@V8/'<0$J"&=N;6(H(?6(
oo(*.+1$J<;6("+(*(d-#8&"/#(&)*&(;$&-;#+(&)$(*.+/0-&$(7*0-$(/d(*#($J<;$++"/#(
4(1!.#
# %+!&(%%$%1L8/'<0$J"&=N;(8*#(/#0=(8)*#P$(.=(?5(3<@*&$(d*"0$@LD(?XD(?6(
( %$004+,-#)%+.&+,)!$.#
(.8#

Some optimizations are possible – for example, checking to see if any rows were actually
affected by the attempted trigger action before incurring the expense of running the trigger body
– but we ignore such possibilities here.
Information Modeling and Relational Databases: Answers (odd)–49

Exercise 13.5

The solutions here assume SQL Server. The syntax for other SQL implementations may vary.

1. A tricky question. The nature of the reference from supervisor to empNr means that an empNr
for a supervising technician must already be stored before it can be referenced as a supervisor.
The only way that a loop could be created with an insert is if a reference to the empNr of the
new row already existed – which is clearly impossible since the row hasn’t yet been inserted!
However, we certainly should implement a check on acyclic relationships such as this because
an update to an existing row in the table could create a loop.
The following stored procedure shows an example of this kind of check. To make sure that the
check is applied on every update we could call the stored procedure from an “after update”
trigger. The stored procedure has two parameters, the second of which has a default value of
null. The procedure is called with just one parameter (the empNr to be checked); the second is
used during recursion. The procedure returns 99 if a loop is detected and 0 otherwise.
,%(+)(#3%$,(+<F9$8)#"8"*#>)$8I(
p.*+$E'<(!.)D((
p&)"+E'<(!.)(K(.200(
+&#
!"(p.*+$E'<(K(p&)"+E'<(%()2%.(\\(oo(;$d$;$#&"*0(0//<(@$&$8&$@(
8(,0+%((p#$c,-<;("#&D(p+-<$;7"+$$("#&D(p;&#("#&(
!"#p&)"+E'<(!&#.200#&()(p+-<$;7"+$$(K(p.*+$E'<((
( (0&(#&()(p+-<$;7"+$$(K(p&)"+E'<(
&(0(,)(p#$c,-<;(K(+-<$;7"+/;("%$'(9$8)#"8"*#(7*(%(($'<N;(K(p+-<$;7"+$$(
!"#p#$c,-<;(!&#.200#%()2%.(b(( oo(&/<(/d()"$;*;8)=(
(/(,(p;&#(K(+<F9$8)#"8"*#>)$8I(p.*+$E'<D(p#$c,-<;(oo(/&)$;c"+$(P/(-<(/#$(0$7$0(
%()2%.(p;&#(

3. ,%(+)(#"2.,)!$.(2'/-#&h"&)8-;;$#8=(
1p8/@$(,*+%1C6D(p*'/-#&(8(,!'+01\DA66(
%()2%.&#6+%,*+%1??6(
+&#
4(1!.#
# 8(,0+%((p+='./0(,*+%D(p;*&$("0$+)(
( &(0(,)(p+='./0(K((+='./0("%$'(>-;;$#8=(7*(%((8/@$(K(p8/@$(
( &(0(,)(p;*&$(K((;*&$("%$'(>-;;$#8=(7*(%((8/@$(K(p8/@$(
( %()2%.(p+='./0(q(,+&)11p*'/-#&(G(p;*&$6(+&#6+%,*+%1?b66(
( oo(&)$(;$+-0&("+(-<(&/(??(8)*;*8&$;+(0/#P("#(&)"+(8*+$(
( oo(&)*&U+(&)$(+='./0(1?6(<0-+(&)$(7*0-$(1-<(&/(\(@"P"&+6(<0-+(&)$(@$8"'*0(</"#&(1?6(
# (.8(

Exercise 13.9

1. The syntax to produce XML from database tables varies between implementations. Here are
examples for SQL Server and DB2. Both of these produce the same structure: a root node called
“myTechnicians” containing a series of elements called “technician”, each of which contains
elements for empNr, lastName and supervisor (the supervisor element will be missing if the
corresponding relational value is null).
oo(,g!(,$;7$;(
Information Modeling and Relational Databases: Answers (odd)–50

&(0(,)($'<N;D(0*+&N*'$D(+-<$;7"+/;((
"%$'(&$8)#"8"*#((
"$%#/'0#+2)$<#(0('(.)&<##
%$$)(1L'=9$8)#"8"*#+L6(
(
oo(4BA(
&(0(,)#/'0(0('(.)#1.+'(#r'=9$8)#"8"*#+rD#
# # /'0+111/'0(0('(.)=.+'(#r&$8)#"8"*#rD(
# # # /'0"$%(&)##
## # # 1&V$'<N;#+&#r$'<N;rD(
# # # &V0*+&#*'$#+&#r0*+&N*'$rD(
# # # &V+-<$;7"+/;#+&#r+-<$;7"+/;r6666(
# "%$'#&$8)#"8"*#(+&(&(

3. Relational tables can be generated from XML, but, again the syntax varies from one
implementation to another. The following examples for SQL Server and DB2 assume that we
already have an XML document called “myTechnicians”.

oo(,g!(,$;7$;(
&(0(,)( 9V8V7*0-$1L$'<N;s?tLD(L"#&L6(+&($'<N;D((
( ( 9V8V7*0-$1L0*+&N*'$s?tLD(L7*;8)*;1Cb6L6(+&(0*+&N*'$D(
( ( 9V8V7*0-$1L+-<$;7"+/;s?tLD(L"#&L6(+&(+-<$;7"+/;(
"%$'(((p'=9$8)#"8"*#+V#/@$+1Lu'=9$8)#"8"*#+u&$8)#"8"*#L6(9186(
(
oo(4BA(
/'0)+40((1Luu&$8)#"8"*#L(
3+&&!.1('=9$8)#"8"*#+(
,$02'.&#
r$'<N;r(!.)#3+)*(S$'<N;UD(
r0*+&N*'$v(6+%,*+%1Cb6(3+)*(L0*+&N*'$LD(
r+-<$;7"+/;r(!.)#3+)*(L+-<$;7"+/;L6(
Information Modeling and Relational Databases: Answers (odd)–51

Exercise 14.2
*$2-,3"
1. "#$ "%$ fjCkS2jekh
*$2%)
Q-=3%9"" Q-=3%9"" 0"&1"#
'(&,-". '(&,-". '(>%1".

*$2)"-,3"

3. (a) 78,#+"#
'(&#. f`((]h

B%)+:,#"6+"- ] B,3"$
'(&,-". 'IBHM.
52*&252/,12(((

(b) Notice the hyphen binding (the hyphen word and any following words are bound to the
next object type term). For example, the constraints on the first fact type verbalize as:
C+,*(,/d&c*;$%&$'()*@((/+,)05#$.((d";+&(j-*;&$;(,*0$+.

/,12)*#$+U2l8,#+"#

/,12$">%&1U2l8,#+"#
B%)+:,#"6+"- B,3"$
'(&,-". 'IBHM.
/,12+/*#1U2l8,#+"#

/,12)%8#+/U2l8,#+"#

5. (a) This solution assumes all students are team members and all teams are full.

*$2,+
W",#["D"3
'(&#. f`((]h
B+81"&+
B+81"&+J,-"
'(&#. ]
/,$ <",-
'(>%1".
*$2*&2P2*&>381"$

(b) *$29#`2-"-;"#2%)

*$29#i2-"-;"#2%)

B+81"&+ <",-
B+81"&+J,-"
'(&#. '(>%1".
/,$
*$29#n2-"-;"#2%)

*$29#]2-"-;"#2%)

As a further exercise, discuss what happens if it is optional for a student to belong to a team.
Information Modeling and Relational Databases: Answers (odd)–52

7.
BVD fj>/#kS2j$">kS2j%#1kh B]D *$2,&2%#1*&,#92-"-;"#2%)

!%$*+*%&
'(>%1".
!"#$%& G%--*++""
!"#$%& G%--*++"" '(&,-". >/,*#$ '(&,-".
'(&,-". '(&,-".
52/%31$252%&252OQ"P
*$2$">#"+,#92%)
O
2#$%"&'()2G%--*++""S
22222',".$-,"$+&2!"#$%&2/%31$2!%$*+*%&2j>/#k2%&2,)',2G%--*++""(
P
2#$%"&'()2G%--*++""S
22222',".$-,"$+&2!"#$%&2/%31$2!%$*+*%&2j$">k2%&2,)',"G%--*++""(

Exercise 14.3

1. (a)
W",#
'GQ.

G*+9 !%=83,+*%&
'(&,-". '(&#.
52*&252/,12(((

(b) /,12>"&$8$2*&
G*+9 W",#
'(&,-". 'GQ.

XG"&$8$Y !%=83,+*%&
'(&#.
R,D"
(c)
*$2%)
G*+9
'(&,-".
!%=83,+*%&
G"&$8$
'(&#.
R,D"
W",#
'GQ.
:,$2*&

(d) I prefer (a). How about you?


(e)
XG*+9!%=83,+*%&Y

G*+9 !%=83,+*%&
'(&,-". /,1 '(&#.
:,$2*&
W",#
'GQ.

This is worse.
Information Modeling and Relational Databases: Answers (odd)–53

3. I prefer the co-referenced version. How about you? Also the software size should more
realistically have been measured in megabytes (MB) not megabits (Mb).

"#$
4"3",$"J#

B*t"
B%)+:,#"<*+3"
'C;M.
$%)+:,#"4"3",$"2:*+/252,&1252/,$2(((

"%$ *$2+/"2+*+3"2%)2,2$%)+:,#"2#"3",$"2:*+/

B%)+:,#"<*+3" 4"3",$"J#

XB%)+:,#"4"3",$"Y B*t"
*$2%) 'C;M.

"&$ /,$
B%)+:,#"<*+3"
B*t"
B%)+:,#"4"3",$"
'C;M.
*$2%)
4"3",$"J#
/,$

5. (a) H+:>%$#,-1B15"./0'H&4"C1/50.8MZ"'81D

@hC1_C1gA
111111111@@9#,1B15"./0'H&4"C1/50.8MZ"'8C14"<&*1D

(b) XG%-="+*&R2rY

!"#$%& B=%#+QD"&+
'(&,-". '(>%1".
>%-="+"12*&

C"1,3
'(>%1". fg0gS2gBgS2gVgh
:%&

(c) {G, S, B}
Competing ( personName, sportEvent, [medalWon] )

(d) I prefer the nested conceptual schema. How about you?


Information Modeling and Relational Databases: Answers (odd)–54

7. (a)
A%8#B3%+
'1/G%1".

B8;E">+ 4%%-
'(>%1". '(&#.
5(2/,$23">+8#"2,+252*&2(((

!"#$%!'()!*+#,,-./0!(.1!23!+#4!%1!#..(5#516!#7!,)181))16
!!!!!!!!!!"6(9%:1;:-.1$!5(!7<(=!&<(-&1!(8!,)-+#)4!>140!1?/?

A%8#B3%+
'1/G%1".

B8;E">+ 4%%-
'(>%1". '(&#.
5(2/,$23">+8#"2,+252*&2(((

(b)
*$2)%#
B8;E">+
'(>%1". *$2*&
4%%-
[">+8#"
'(&#.
A%8#B3%+
'1/G%1".
*$2,+

9. (a) :*&$2P2*$2:%&2;9

≤2]
G38; QD"&+ fj[*R/+:"*R/+kS
'(&,-". '(&,-". 2jC*113":"*R/+kS
*$2)*&,3*$+2*& 2jA",D9:"*R/+kh

*$2$">%&12*&

(b) *$2)*&,3*$+2*&
fj[*R/+:"*R/+kS
QD"&+
'(&,-". 2jC*113":"*R/+kS
G38; ≤2] 2jA",D9:"*R/+kh
'(&,-".
!3,>"
'(&#. f`S2ih
52*&252R%+2(((

(c) XQD"&+e*&,3*$+2rY
≤2] fj[*R/+:"*R/+kS
G38; QD"&+
2jC*113":"*R/+kS
'(&,-". '(&,-".
*$2)*&,3*$+2*& 2jA",D9:"*R/+kh

!3,>"
'(&#. f`S2ih
R%+
Information Modeling and Relational Databases: Answers (odd)–55

9. (d) This solution assumes that if any results are recorded at all, then all the final results must
be recorded (i.e. record all results of the completed competition or record no results).
XQD"&+e*&,3*$+Y
] fj[*R/+:"*R/+kS
G38; QD"&+
2jC*113":"*R/+kS
'(&,-". '(&,-".
*$2)*&,3*$+2*& 2jA",D9:"*R/+kh

!3,>"
'(&#. fj`kS2jikS2jnLkS2jnVkh
R%+

(e)
fj[*R/+:"*R/+kS
QD"&+
2jC*113":"*R/+kS
'(&,-".
2jA",D9:"*R/+kh
]
G38; !3,>"
'(&,-". '(&#. fj`kS2jikS2jnLkS2jnVkh
52*&252R%+2(((

(f) I prefer solution (e) to (d). How about you?

Exercise 14.4

1. (a) 8$"$ *$2%)


Q-=3%9"" !/%&"<9="
!/%&"J#
'(&#. '(>%1".
≤2i
fj?kS2jAkh

(b) 8$"$2:%#@U

Q-=3%9""
!/%&"J#
'(&#.

8$"$2/%-"U

Note: If we remove the mandatory component of the xor constraint we need to restore
the fact type :)/#$("+(/d(:)/#$9=<$(`ShUD(SiUa to preserve phone type information

(c) 8$"$ *$2%)


Q-=3%9"" !/%&"<9="
!/%&"J#
'(&#. '(>%1".
≤2i
fj?kS2jAkh

(d) 8$"$
?%#@!/%&"J#
Q-=3%9"" !/%&"J#
'(&#.
A%-"!/%&"J#
8$"$

Here the subtypes are asserted (to instead derive them, add the PhoneType fact type).
Information Modeling and Relational Databases: Answers (odd)–56

3. (a)
!"#$%& !"#$%&<9=" f2j[">+8#"#kS
'(&#. '(&,-". 2jB+81"&+kh
*$2%)

(b) !"#$%& !"#$%&<9=" fj[">+8#"#Z&39kS


'(&#. '(&,-". 2jB+81"&+Z&39kS
*$2%) 2j[">+8#"#wB+81"&+kh

(c) *$2,23">+8#"#
!"#$%&
'(&#.
*$2,2$+81"&+

(d) *$2,23">+8#"#

!"#$%&
*$2,2$+81"&+
'(&#.

*$2,21#*D"#

5. (a) /,$2FU

/,$29U
Z;E">+
G%%#1*&,+"
'(&,-".

/,$2tU

(b) /,$2FU

/,$29U
Z;E">+
!%$*+*%& G%%#1*&,+"
'(&,-".
*$2,+

/,$2tU

(c)
LF*$<9="
'(&,-". fjvkS2jWkS2j}kh

n
Z;E">+
G%%#1*&,+"
'(&,-".
52)%#252/,$252 O

2R,".$-,"$+&2Z;E">+2/,$2,)&"-'.&2G%%#1*&,+"2-&,(
O

Note: The textual constraint is somewhat expensive to enforce.


Information Modeling and Relational Databases: Answers (odd)–57

Exercise 14.5

1. (a) ["D"3 fjI0kS2j!0kh


'(>%1".

H"=,#+-"&+ i
78,&+*+9
'(>%1".
52,+252/,$2$+81"&+$2*&2(((

1111111]111111111111@LhC1-hA
0$)E%,$8#7$&#1)$#+,@B1<"58F0<"C1*"Z"*C1'._8+<"'8/1D

(b) /,$28&1"#R#,12$+81"&+$2*&

H"=,#+-"&+
78,&+*+9
'(>%1".

/,$2=%$+R#,12$+81"&+$2*&

8%>!&$:%,$1B1<"58F0<"C1'.Lh/8+<"'8/C1'.-h/8+<"'8/1D

1. (c)
["D"3 fjI0kS2j!0kh
'(>%1".

H"=,#+-"&+ H"=,#+-"&+ i
78,&+*+9
J,-" '(>%1".
*$2%)2P2/,$ 52,+252/,$2$+81"&+$2*&2(((

@@@@@@@@@@@@8%>!&$:%,$1B1<"58F0<"C1<"58H&4"1D

1111]111111111111111@LhC1-hA
0$)E%,$8#7$&#1)$#+,@B1<"58F0<"C1*"Z"*C1'._8+<"'8/1D

(d)
/,$28&1"#R#,12$+81"&+$2*&

H"=,#+-"&+ H"=,#+-"&+
78,&+*+9
J,-" '(>%1".
*$2%)2P2/,$

/,$2=%$+R#,12$+81"&+$2*&

8%>!&$:%,$1B1<"58F0<"C1<"58H&4"C1!1'.Lh/8+<"'8/C1'.-h/8+<"'8/1,1D
Information Modeling and Relational Databases: Answers (odd)–58

3. (a) 11111111111@VC1]A
;&+2;&+-&%77@@@@@B15.0E"$8C1/28"C1/8&("C1"'<7&8"1D

;&+2.)E-%$ 1B15.0E"$8C1/28"C1=+<("81D

;&+24>0?7 1B15.0E"$8C1/28"C105_6/8"41D
≤1]
1111@?hOC1WhOA
;&+20/#"" 1B15.0E"$8C1/;2**1D

111111111]
;&+2;&+-&!::%&B15.0E"$8C1"45H.1D

;&+-&!::%& 1B1"45H.C1"45H&4"C1$*&//1D
1111@k+'20.C1_"'20.A

=B>%&$($ 1B1"45H.C1*&'(+&("1D

L+M#3%($ 1B1"45H.C1*&'(+&("1D

3. (b) For the -+$+ and $'<0/=+ predicates, the schema has been strengthened to make the first
of these mandatory (if this is not done, a disjunctive mandatory constraint is needed).

"&1"12$+,R"2`2%&
/,$
V81R"+ H,+"
'IBHM. '-19.

"&1"12$+,R"2i2%&

&""1$2,2n0[ !#%E">+ B*+"


'(&,-". '(&,-".
*$2,+
&""1$2,2]0[ 8$"$
X!#%E">+L+B*+"Y
Z="#,+*&RB9$+"-
'(&,-".
2/,$
|8&*%#
!#%R#,--"#! ,3$%28$"$ *$2%)
!#%R#,--*&R fj|8&*%#kS
G3,$$ jB"&*%#kh
!#%E">+! '(&,-".
!#%R#,--"#
/,$
'"-=J#. !#%R#,--"#
2/,$
J,-"
B"&*%#
!#%R#,--"#!
52@&%:$252,+2(((2O
["D"3
!2'()2!#%R#,--*&R!#%E">+20-"'2!#%E">+ '(&,-".
,)',2&""1$2,2n0[2$%2&""1$2,2]0[(
[,&R8,R" fjQF="#+kS
!2'()2|8&*%#!#%R#,--"#"0-"'2!#%R#,--"#
'(&,-". jJ%D*>"kh
1)$2*$2%)2G3,$$2j|8&*%#k(
!2'()2B"&*%#!#%R#,--"#"0-"'"!#%R#,--"#
1)$2*$2%)2G3,$$2jB"&*%#k(
O
22'()2!#%R#,--"#2@&%:$2-$.&"[,&R8,R"2,+2["D"32jQF="#+k(
Information Modeling and Relational Databases: Answers (odd)–59

3. (c)

;&+2%3$0#$%@111B15.0E"$8C1/28"C1=+<("8C105/6/KC1!05/6/g,C1!/8&("V"'<,C1!/8&("]"'<,1D

111@:CJA111111111@:CJA 111111111111111111111≠
;&+-;&+2%3$@1B15.0E"$8C1'""</?hOC1'""</WhOC1!E+'20.-.0(.&44".C1/"'20.-.0(.&44".,!1D
4 8
1111
;&+-&!::%&@B1"45H.C1"45H&4"C1$*&//D
1111@k+'20.C1_"'20.A
1@M#5".8C1H0Z2$"A
3
N,+G"%E-%@@@B1"45H.C1*&'(+&("C1*"Z"*1D

!1-5)6/6#'$&(#)*#'""</?hO1',1'""</WhO UU18."&82'(1+'&.2"/1&/1g00"*&'
3
1)$1^'0G*"<(">"45H.172-,-#*"Z"*1Q1SM#5".8S
4
1'$&(#72-,-1-.0(.&44".>$*&//1Q1Sk+'20.S
81'$&(#72-,-1-.0(.&44".>$*&//1Q1S_"'20.S

(b)1 The "#7/07$+ predicate in the original conceptual schema and its external uniqueness
constraint fail to cater for programmers changing their class during a project. An unrealistic
resolution would be to demand that the external constraint be enforced anyway (e.g. by
changing one or both of the programmers, and only storing the current project team); but
this would fail anyway if the external uniqueness is still applied after the project is over and
a programmer on the project has his/her class changed.
In realistic business practice, we would not change a programmer during a project
anyway except in rare cases (e.g. demoted because of incompetence to work on the
project). So the original conceptual schema needs to be changed. There are various
options (e.g. delete the external uniqueness constraint, apply it only at the initial
formation of a project team, or maintain history of project team membership). This
change also would also require a change to the optimized schema.

Exercise 14.6

1. (a) The Child column is not atomic. So the table is not even in 1NF.
(b) The nonkey attribute is functionally dependent on just part of the key (person). hNF = 1.
(c) Nonkey attributes depend on just part of the key (e.g. parent ! sexOfParent). hNF = 1.
(d) Child attribute depends on only part of the key (tutorName).
hNF = 3 (not 1, since child is part of the key).
(e)
A)$+&7I,@B15"./0'H&4"C1/+=E"$8F0<"1D

;%&7+,1B15"./0'H&4"C1("'<".C1!/+=E"$8O"$8+."<,1D

≤1]
;!&%,$451B15&."'8C1$%2*<1D! O
2,$9--"+#*>2,&12*&+#,&$+*+*D"

Note: If Subject plays other mandatory, functional roles (as is likely in practice) the fact
type :$;+/#( 0$8&-;$+( ,-.Q$8& should be mapped instead to a Subject table that stores
functional facts for Subject.
Information Modeling and Relational Databases: Answers (odd)–60

3. (a) This solution uses employee numbers instead of names, and ignores history aspects such as
trainees later becoming managers.

<#,*&""
'Q-=J#.

C,&,R"# !#%E">+
'Q-=J#. '(&,-".
52$8="#D*$"$252%&2(((

(b) Here and later, we assume that this is just part of a schema in which managers play other
mandatory roles (e.g. having a name), that it is possible for some managers to do no
supervision, and that a project may have many supervisors.
.
<#,*&""
'Q-=J#.

52$8="#D*$"$252%&2(((

C,&,R"# !#%E">+
'Q-=J#. '(&,-".

$8="#D*$"$

(c) The ternary is compound, since there is an implied FD from its first role to its last role.
So it should be split as shown below.

$8="#D*$"$
!#%E">+
'(&,-".
C,&,R"#
'Q-=J#.
<#,*&""
'Q-=J#.
$8="#D*$"$

(d) $8="#D*$"$
!#%E">+
'(&,-".
C,&,R"#
'Q-=J#.
<#,*&""
'Q-=J#.
$8="#D*$"$

(e) This solution ignores all other fact types that might exist in the global schema.

@@@@;&+2%3$0)>%&M#7#+,@B14(.M45H.C15.0E"$8H&4"1D

A&!#,%%0)>%&M#7#+,1B14(.M45H.C18.&2'""M45H.1D

(f)

0)>%&M#7#+,1B14(.M45H.C18.&2'""M45H.C15.0E"$8H&4"1D
Information Modeling and Relational Databases: Answers (odd)–61

Exercise 14.7

1. 0$)E%,$@B1/8+<"'8H.C1/8+<"'8H&4"C1<"(.""1D

D%7)"$11B1/8+<"'8H.C1/+=E"$8F0<"C1/8+<"'8'&4"C1!.&82'(,1D
!

Minor disadavantages: updates are more expensive because of the pair-subset constraint; more
storage space is required.

Exercise 14.8

1. (a)
+",>/"$ *$2:%#+/
B8;E">+ G#"1*+
52:,$2,:,#1"1252;92((( '(>%1". '(=%*&+$.
I&*D"#$*+9 ≤2i
'(>%1". *$2,2$"&*%#23">+8#"#2*&
L>,1"-*>
H"R#"" 'Q-=J#.
'(>%1".
H"=,#+-"&+
W",# '(&,-".
'GQ. *$2,23">+8#"#2*&
52:,$2,:,#1"1252*&2(((

*$2,2=#%)"$$%#2*&

(b)
*$2%)2P2/,$
4,&@ *$2:%#+/
fj[kS2jB[kS2j!kh '(>%1". *$2+",>/"#`2%)
B8;E">+ G#"1*+
'(>%1". '(=%*&+$.
:,$2,:,#1"1
H"R#"" L>,1"-*>
'(>%1". 'Q-=J#.
*$2+",>/"#i2%)
XL:,#1Y

:,$2;9 :,$2*& H"=,#+-"&+


'(&,-".
:%#@$2)%#

I&*D"#$*+9 W",#
'(>%1". 'GQ.

1. (c)
@@@@@(G!&E1B1"45H.C1<"(.""C1+'2Z"./286C1!&G&.<I"&.,1D

@OC1_OC1-A
(3!E%:#31B1"45H.C1.&';C1<"581D

@@@0)12%3$1B1/+=E"$8F0<"C1$."<28C1!18"&$%".VC1!8"&$%".],1,1D

Information Modeling and Relational Databases: Answers (odd)–62

1 (d)
Award: empNr degree university awardYear
30572 PhD UQ 1990

Academic: empNr rank dept


30572 SL Computer Science

Subject: subjectCode credit teacher1 teacher2


CS115 8 30572 ?

Exercise 14.9

1 (a) The Car table is denormalized. Its effective key is vin. The non-key attributes bwd, fwd,
“4wd”, awd, manufacturer, modelname and yearmade are all functionally dependent on the
nonkey attribute carModelId. So facts such as CarModel ‘M1’ has Manufacturer ‘Mazda’
may be duplicated.
The Color table is denormalized. It has no effective key; even (colorCode, primaryColor) is
not a key since primaryColor is optional. The attribute colorName is functionally dependent
on colorCode, which is not a whole key. So facts such as Color ‘PL’ has ColorName ‘PLUM’
may be duplicated.
The Customer table is denormalized. It has no effective key; even (customerId, phoneNr) is
not a key since phoneNr is optional. The nonkey attribute customerName is functionally
dependent on the nonkey attribute customerId, and is combined with the multi-valued
dependency from customerId to phoneNr. So facts such as Customer 201 has CustomerName
‘John Smith’ may be duplicated.
The Sale table is denormalized. The nonkey attribute empName is functionally dependent on
the nonkey attribute empNr. So facts such as Employee 51 has EmpName ‘Tom Brown’ may
be duplicated.
Comment
In the relational model, relations must have keys, and keys cannot have nullable attributes. In
SQL, relations are not required to have keys at all. Consider the following simplified customer
subschema.

G8$+%-"#2r
!/%&"J#
'(*1.
/,$

This Rmaps to the following relational schema, which is consistent with the relational model:

H)7$+:%&1B1$+/804".b<1D

O!7;*+,%1B1$+/804".b<C15%0'"H.1D
Information Modeling and Relational Databases: Answers (odd)–63

However, in SQL it is permitted to map this to a single, keyless table, as shown below. This
table has a uniqueness constraint but no key, since keys cannot have nullable components.
Although some people use the term “key” in a weaker sense that does allow nulls, this
contradicts the definition of key in the relational model.

H)7$+:%&1B1$+/804".b<C1!5%0'"H.,1D

1. (b) The following schema was produced with the NORMA tool. There is an additional textual
constraint that each RGB intensity pattern corresponds to at most one color.

(c) &(0(,)#R$7"$cV8*;Y/@$0%@D(R$7"$cV'*P*w"#$D(8;"&$;"/#D(;*&"#P(
"%$'((>*;,*0$?VR$7"$c(0(")#$2)(%#9$!.(>*;,*0$?VR$7"$cR$+-0&(
( $.(R$7"$cV8*;Y/@$0%@(K(R$7"$cR$+-0&V8*;Y/@$0%@(
# #####+.8(R$7"$cV'*P*w"#$(K(R$7"$cR$+-0&V'*P*w"#$(
( (((((+.8(8;"&$;"/#(K(LE8/#/'=L( oo(%&'()*+(7*(%((8;"&$;"/#(K(LE8/#/'=L($%(8;"&$;"/#(!&#.200(

(d) &(0(,)(E'<0/=$$V$'<N;D(,%-1E'<0/=$$V$'<N*'$6(+&($'<N*'$D(,%-1P$#@$;6(+&(P$#@$;D(
## # ###./,1+*0$:;"8$6(+&(+*0$+9/&*0(
( ( ( "%$'(((>*;,*0$?VE'<0/=$$(9$!.(>*;,*0$?V,*0$(
( ( ( ( $.(E'<0/=$$V$'<N;(K(,*0$V$'<N;(
7*(%((E'<0/=$$V$'<N;(!.(
Information Modeling and Relational Databases: Answers (odd)–64

( 1&(0(,)($'<N;("%$'(>*;,*0$?V!*#P-*P$N/7"8$(
( (7*(%((d/;$"P#!*#P-*P$(K(L,<*#"+)L6(
((($%(E'<0/=$$V$'<N;(!.(
( 1&(0(,)($'<N;("%$'(>*;,*0$?V!*#P-*P$EJ<$;&(
( (7*(%((d/;$"P#!*#P-*P$(K(L,<*#"+)L6( oo(%&'()*+($'<N;("#(3#"/#(
1%$23#45(E'<0/=$$V$'<N;(( (((oo(%&'()*+(P;/-<(.=(#*'$(*#@(P$#@$;(&//("#+&$*@(/d(-+"#P('*J(

1. (e) &(0(,)(7"#D(>*;V8/0/;>/@$D(8*;Y/@$0%@D((
,+&(#
# ## 7*(.(.c@(K(?()*(.(L.c@L(
( 7*(.(dc@(K(?()*(.(Ldc@L(
( 7*(.(rfc@r(K(?()*(.(Lfc@L(
( 7*(.(*c@(K(?()*(.(L*c@L(
( (((.8#+&(@;"7$F+&*&-+(
"%$'(>*;,*0$?V>*;(9$!.(>*;,*0$?V>/0/;(+&(>/0/;?(
# # $.(>*;V8/0/;>/@$(K(>/0/;?V8/0/;>/@$(
(((9$!.(>*;,*0$?V>/0/;(+&(>/0/;A(
#$.(>/0/;?V8/0/;>/@$(K(>/0/;AV8/0/;>/@$(
(((( (+.8(>/0/;?V<;"'*;=>/0/;(K(LRL(+.8(>/0/;AV<;"'*;=>/0/;(K(L]L(
(((( (+.8(>/0/;?V"#&$#+"&=(K(>/0/;AV"#&$#+"&=(

(f) This ORM schema was produced in the NORMA tool.


Information Modeling and Relational Databases: Answers (odd)–65

1.1 (g) The following relational schema was generated from the ORM Source Model solution in
Microsoft Visio for Enterprise Architects.

(h) The following trigger code is for SQL Server 2005.

,%(+)(#)%!11(%(&;F>/0/;FR]B<*&&$;#3>(
$.(>*;,*0$AV>/0/;(
+")(%(!.&(%)<#238+)(#+&#
!"(pp01231/4((K(b(%()2%.#
!"(567%()1;$@%#&$#+"&=6($%(567%()1P;$$#%#&$#+"&=6($%(567%()1.0-$%#&$#+"&=6(
###!"#(/!&)&#1(&(0(,)#?("%$'#>*;,*0$AD>/0/;(
7*(%(#;$@%#&$#+"&=(!&#.$)#.200#+.8(P;$$#%#&$#+"&=(!&#.$)#.200#+.8#.0-$%#&$#+"&=(!&#
.$)#.200#
1%$23#45#;$@%#&$#+"&=D(P;$$#%#&$#+"&=D(.0-$%#&$#+"&=(
(*+6!.1(,$2.)=E:#F#?(6#
4(1!.#
( R*"+$;;/;(1LE*8)(R]B("#&$#+"&=(<*&&$;#(*<<0"$+(&/(*&('/+&(/#$(>/0/;VLD?XD?6(
( %$004+,-#)%+.&+,)!$.#
(.8#

(d)1 The following code is written for SQL Server 2005.

!.&(%)#!.)$(>*;,*0$AV>/0/;(
&(0(,)(R8/0/;V8/0/;>/@$D(R8/0/;V8/0/;N*'$D((
( R8/0/;V"#&$#+"&=(+&(;$@%#&$#+"&=D(]8/0/;V"#&$#+"&=(+&(P;$$#%#&$#+"&=D(B8/0/;V"#&$#+"&=(+&(.0-$%#&$#+"&=(
"%$'#>*;,*0$?V>/0/;(+&(R8/0/;(
( 9$!.(>*;,*0$?V>/0/;(+&(]8/0/;((
Information Modeling and Relational Databases: Answers (odd)–66

( $.(R8/0/;V8/0/;>/@$(K(]8/0/;V8/0/;>/@$((
( (((+.8(1R8/0/;V<;"'*;=>/0/;(K(LRL($%(R8/0/;V<;"'*;=>/0/;(!&#.2006(
( (((+.8(1]8/0/;V<;"'*;=>/0/;(K(L]L($%(]8/0/;V<;"'*;=>/0/;#!&#.2006(
( 9$!.(>*;,*0$?V>/0/;(+&(B8/0/;($.(]8/0/;V8/0/;>/@$(K(B8/0/;V8/0/;>/@$(
(( (((+.8(1B8/0/;V<;"'*;=>/0/;(K(LBL($%(B8/0/;V<;"'*;=>/0/;(!&#.2006(
(
!.&(%)#!.)$(>*;,*0$AV>*;Y/@$0(
&(0(,)(8!&)!.,)(8*;Y/@$0%@D('*#-d*8&-;$;D('/@$0N*'$D(=$*;Y*@$D(
( ,+&(##
( ( 7*(.(.c@(K(?()*(.(L.c@L(
( ( 7*(.(dc@(K(?()*(.(Ldc@L(
( ( 7*(.(rfc@r(K(?()*(.(Lfc@L(
( ( 7*(.(*c@(K(?()*(.(L*c@L(
( (.8(+&(@;"7$n"#@(
"%$'(>*;,*0$?V>*;(
(
!.&(%)#!.)$(>*;,*0$AV>*;(
&(0(,)(m%ND(8*;Y/@$0%@D(8/0/;>/@$(
"%$'(>*;,*0$?V>*;(
(
!.&(%)#!.)$(>*;,*0$AVR$7"$c(
&(0(,)(R$7"$cV8*;Y/@$0%@D(R$7"$cV'*P*w"#$D(,*d$&=R$7"$cV;*&"#P(+&(+*d$&=R*&"#PD(
#(E8/#/'=R$7"$cV;*&"#P(+&($8/#/'=R*&"#PD(:$;d/;'*#8$R$7"$cV;*&"#P(+&(<$;d/;'*#8$R*&"#PD(
((,&=0$R$7"$cV;*&"#P(+&(+&=0$R*&"#P(
"%$'(>*;,*0$?VR$7"$c(0(")#$2)(%(9$!.(>*;,*0$?VR$7"$cR$+-0&(+&(,*d$&=R$7"$c(
##### #$.(R$7"$cV8*;Y/@$0%@(K(,*d$&=R$7"$cV8*;Y/@$0%@(+.8(R$7"$cV'*P*w"#$(K(,*d$&=R$7"$cV'*P*w"#$(
( (((((+.8(,*d$&=R$7"$cV8;"&$;"/#(K(L,*d$&=L(
0(")#$2)(%(9$!.(>*;,*0$?VR$7"$cR$+-0&(+&(E8/#/'=R$7"$c(
#$.(R$7"$cV8*;Y/@$0%@(K(E8/#/'=R$7"$cV8*;Y/@$0%@(
####(+.8(R$7"$cV'*P*w"#$(K(E8/#/'=R$7"$cV'*P*w"#$(+.8(E8/#/'=R$7"$cV8;"&$;"/#(K(LE8/#/'=L(
0(")#$2)(%(9$!.(>*;,*0$?VR$7"$cR$+-0&(+&(:$;d/;'*#8$R$7"$c(
#$.(R$7"$cV8*;Y/@$0%@(K(:$;d/;'*#8$R$7"$cV8*;Y/@$0%@(
####(+.8(R$7"$cV'*P*w"#$(K(:$;d/;'*#8$R$7"$cV'*P*w"#$((
#####+.8(:$;d/;'*#8$R$7"$cV8;"&$;"/#(K(L:$;d/;'*#8$L(
0(")#$2)(%(9$!.(>*;,*0$?VR$7"$cR$+-0&(+&(,&=0$R$7"$c(
#$.(R$7"$cV8*;Y/@$0%@(K(,&=0$R$7"$cV8*;Y/@$0%@(+.8(R$7"$cV'*P*w"#$(K(,&=0$R$7"$cV'*P*w"#$(
( ((((((+.8(,&=0$R$7"$cV8;"&$;"/#(K(L,&=0$L(
(
!.&(%)#!.)$(>*;,*0$AV>-+&/'$;(
&(0(,)(>-+&/'$;?V8-+&/'$;%@D(>-+&/'$;?V8-+&/'$;N*'$D(>-+&/'$;?V<)/#$N;D(>-+&/'$;AV<)/#$N;(
"%$'(>*;,*0$?V>-+&/'$;(+&(>-+&/'$;?(0(")#$2)(%#9$!.(>*;,*0$?V>-+&/'$;(+&(>-+&/'$;A(
(( ($.(>-+&/'$;?V8-+&/'$;%@(K(>-+&/'$;AV8-+&/'$;%@(+.8(>-+&/'$;?V<)/#$N;(OH(>-+&/'$;AV<)/#$N;(
7*(%((>-+&/'$;?V<)/#$N;(O(>-+&/'$;AV<)/#$N;(
(((((((((((($%(>-+&/'$;AV<)/#$N;(!&#.200(
(
aliter:
!.&(%)#!.)$(>*;,*0$AV>-+&/'$;(
&(0(,)(>-+&/'$;?V8-+&/'$;%@D(>-+&/'$;?V8-+&/'$;N*'$D(>-+&/'$;?V<)/#$N;(+&(d";+&:)/#$N;D(
#(>-+&/'$;AV<)/#$N;(+&(+$8/#@:)/#$N;((
Information Modeling and Relational Databases: Answers (odd)–67

"%$'(>*;,*0$?V>-+&/'$;(+&(>-+&/'$;?(9$!.(>*;,*0$?V>-+&/'$;(+&(>-+&/'$;A(
#$.(>-+&/'$;?V8-+&/'$;%@(K(>-+&/'$;AV8-+&/'$;%@(
7*(%((>-+&/'$;?V<)/#$N;(O(>-+&/'$;AV<)/#$N;(
(((((($%(>-+&/'$;?V<)/#$N;(!&#.200(+.8(>-+&/'$;AV<)/#$N;(!&#.200(
2.!$.#
&(0(,)(>-+&/'$;V8-+&/'$;%@D(>-+&/'$;V8-+&/'$;N*'$D(>-+&/'$;V<)/#$N;D(.200(
"%$'(>*;,*0$?V>-+&/'$;(
7*(%((8-+&/'$;%@(!.(
(1&(0(,)(8-+&/'$;%@("%$'(>*;,*0$?V>-+&/'$;(
((1%$23#45(8-+&/'$;%@D(8-+&/'$;N*'$(
((*+6!.1#,$2.)(18!&)!.,)(<)/#$N;6(K(?6(
(
!.&(%)#!.)$(>*;,*0$AVE'<0/=$$(
&(0(,)(G("%$'(>*;,*0$?VE'<0/=$$(
(
!.&(%)#!.)$(>*;,*0$AV,*0$(
&(0(,)(+*0$N;D(m%ND(8-+&/'$;%@D(+*0$:;"8$D($'<N;((
"%$'(>*;,*0$?V,*0$(
(
!.&(%)#!.)$(>*;,*0$AVe/;$"P#!*#P-*P$,I"00!$7$0(
&(0(,)(GD(L#/7"8$L(+&(+I"00!$7$0((
"%$'(>*;,*0$?V!*#P-*P$N/7"8$(
2.!$.(
&(0(,)(GD(L$J<$;&L(+&(+I"00!$7$0((
"%$'(>*;,*0$?V!*#P-*P$EJ<$;&(
(
1. (j)
&(0(,)(8*;Y/@$0%@D('*P*w"#$D($8/#/'=R*&"#P(
"%$'(>*;,*0$AVR$7"$c(
(
&(0(,)(E'<0/=$$V$'<N;D($'<0/=$$N*'$D(P$#@$;D(+-'1+*0$:;"8$6(+&(+*0$+9/&*0(
"%$'(>*;,*0$AVE'<0/=$$(9$!.(>*;,*0$AVe/;$"P#!*#P-*P$,I"00!$7$0(
$.(E'<0/=$$V$'<N;(K(e/;$"P#!*#P-*P$,I"00!$7$0V$'<N;(
(((+.8(d/;$"P#!*#P-*P$(K(L,<*#"+)L(
((((9$!.(>*;,*0$AV,*0$(
( ( ( ( $.(E'<0/=$$V$'<N;(K(,*0$V$'<N;(
1%$23#45(E'<0/=$$V$'<N;D($'<0/=$$N*'$D(P$#@$;(
(
&(0(,)(m%ND(>*;V8/0/;>/@$D(>*;V8*;Y/@$0%@D(@;"7$n"#@(
"%$'(>*;,*0$AV>*;(9$!.(>*;,*0$AV>/0/;((
( ( ( ( $.(>*;V8/0/;>/@$(K(>/0/;V8/0/;>/@$(
( ( ( ( (((+.8(;$@%#&$#+"&=(K(P;$$#%#&$#+"&=(
((((9$!.(>*;,*0$AV>*;Y/@$0(
( ( ( ( $.(>*;V8*;Y/@$0%@(K(>*;Y/@$0V8*;Y/@$0%@(
Information Modeling and Relational Databases: Answers (odd)–68

Exercise 15.7

1. (a)
-,@"2
>,;*&"+

,>l8*#"2 >8+2+%2
3,92%8+ ,$$"-;3" )*&*$/
-,+"#*,3$ 3,9%8+
$,:

$"3">+2
R"+2:%%1 -",$8#" -,#@ )*+2E%*&+$ R38" $,&1 =,*&+
=3,&
#83"# #83"#S2="&>*3 R38" $,&1=,="# =,*&+

>/">@2)*+ ,1E8$+2)*+

>/*$"3S2$,&1=,="#

(b) The resources that appear to be appropriate are marked on the diagram above. Hmmm – we
don’t seem to have any use for the screwdriver.
(c)1 Some resources are consumed by activities. Examples in this case would be glue, sandpaper
and paint. We would have to monitor the consumption of these and replenish at frequent
intervals. Other resources need to be there, but are not consumed by the activities (except in
a microscopic way). Examples in this case are saw, ruler, chisel.
(d)1 The process should be suspended after gluing and before finishing to give the glue time to
set. Also, note that the process cannot be considered complete until the paint has dried, even
though there are no subsequent activities
(e)1 The activities “layout” and “cut to layout” will be required for each part. The activity
“assemble“ will be required for each set of joining parts. We can't predict in advance how
many instances of these activities there will be (why?). The activities “acquire materials”
and “finish” would probably only occur once per process instance. (Given sufficient
resources we could also have multiple instances of the whole “make cabinet” process
active simultaneously.)
(f)1 This is a trivial example, but it reveals many of the features of real business process design
-1 we start from a business description
-1 we break the process down into activities that we can define in a straightforward way,
usually a hierarchical breakdown
-1 we associate resource types with each activity
-1 defining the process may make us realize that we need to define or refine other
elements of our business model
"1 other processes (such as replenish glue, paint and sandpaper)
"1 other types of element (such as rules to specify the fit of the joints)
"1 more data (e.g., the properties of the wood) that might be required by the
process
-1 note that the structure is not sufficient to completely define the process (e.g., think
about the “cut to layout” and “assemble” activities).
Information Modeling and Relational Databases: Answers (odd)–69

3. (a) Although the state model is consistent with the description given, the state <off, hot> does
not seem to be very sensible – we could predict a rapid melt-down of the hair dryer under
these conditions! Problems of this kind could be caused by sloppy specification or a genuine
design flaw. An information analyst has the responsibility to identify such issues and to
facilitate their resolution.
(b) A composite diagram would resemble the following.

A,*#1#9"#

B?`UI= B?`UI=

%)) $3%: ),$+


e,& B?`UH%:& B?`UH%:&

B?iUH%:&

>%%3 /%+
B?iUI=
A",+

(c)1 A composite diagram with the “Swirl” control would resemble the following.

A,*#1#9"#

B?`UI= B?`UI=

%)) $3%: ),$+


e,& B?`UH%:& B?`UH%:&

B?iUH%:&

>%%3 /%+
B?iUI=
A",+

B?nUI= B?nUI=

%)) -"1*8- /*R/


B?nUH%:& B?nUH%:&
B:*#3

(d)1 Without composite states we are faced with a potential explosion of replication. In this
case, we would need the equivalent of three copies of the original six-state diagram; one
copy for each of the “swirl” positions. In realistic scenarios, with many attendant variables,
state diagrams quickly become unmanageable if composite states are not used.

5. The two workflows are equivalent. The workflow on the left contains arbitrary cycles, so, for
example, it’s possible to jump into the middle of a looping construct. In general, arbitrary loops
can be converted to a block structured form, though this may take a little thought. The workflow
on the right includes some auxiliary variables (y and z) that are specified in terms of original
variables w and x. The main loop (a block) is controlled by z – one of the auxiliary variables.
This kind of transformation may be necessary when dealing with languages that are purely
block structured.
Information Modeling and Relational Databases: Answers (odd)–70

Exercise 16.8

1. This allows creation of a table before adding columns.

!%$*+*%&
*$2-,&1,+%#9 '(&#.
/,$

G%38-& G%38-&J,-"
/,$
<,;3"2r
*$2,2=#*-,#92@"92>%38-&
'(&,-".
*$2*&

"E.+21_245*"-^8&=*"1)6#.1:&=*"
##########/2./1%&/1-5.+/&(#'$-1F0*+4' B*-=3"!q
#/2./#2/1&15.24&.61;"61$0*+4'> +,;3"!
#")"#"&>"$

3. /,$2-*&*-8-U
fjakS2j`kh
L++#*;8+"Z#L$$%>*,+*%&Q&1 C83+*=3*>*+9
'(*1. '(>%1".
S
L$$%>*,+*%&4",1*&R fj`kS2j&kh
4%3"J,-" /,$2-,F*-8-U fjakS2j`kS2j&kh

*$2%)2P2/,$
/,$
/,$ L++#*;8+"J,-" /,$
/,$2P2*$2%) \*$*;*3*+9
L++#*;8+"
≥] P '(&,-".
L$$%>*,+*%& G3,$$
L$$%>*,+*%&Q&1
'(&#. '(&,-". fj=8;3*>kS2j=#*D,+"kS
*$2=3,9"12;9 /,$2P2*$2%)
22j=#%+">+"1kS2j=,>@,R"kh
O $=,&$
#",1$2)#%- B8;>3,$$G%&$+#,*&+ N$8="#>3,$$O
'(&#.
V*&,#9L$$%>*,+*%&! ≥] *$2,2$8;>3,$$2%)
XB8;>3,$$G%&&">+*%&2rY
*$2%)
!2'()2V*&,#9L$$%>*,+*%&20-"'+2L$$%>*,+*%&
2"",)',2/,$2&K'(,=52i2L$$%>*,+*%&Q&1( O2#$%"&'()2B8;>3,$$G%&$+#,*&+S

4$*%&@7)1$?$>%7@!&%@!77%&$%EP 2222&'()2$8;>3,$$G%&&">+*%&2/,$2,)&"-'.&2$8="#>3,$$(
G%&$+#,*&+<9=" P2#$%"&'()2G3,$$S
'(&,-".
2222&'()2),#U#%3"2&,-"20-"30-,0+(,(
S2e,>+2+9="2#",1*&R$2'>3,$$2&,-"$2_2,$$%>*,+*%&2#",1*&R.2,#"28&*l8"(
fj1*$E%*&+kS2j>%-=3"+"kh

5.
*$2$+,#+*&R2O
B+,+"
'(&,-".
*$2,>>"=+*&R
L>+*%&
'(&,-".
52>/,&R"$252+%2((( O"
R,".$-,"$+&2B+,+"2*$2$+,#+*&R(

Note: A completed transition graph has additional constraints:


G)#0(+&)#$.((,&*&$("+(+&*;&"#PV(
G)#0(+&)#$.((,&*&$("+(*88$<&"#PV(
( ( ( H$%#(+,*(,&*&$?D(
(&$'((28&"/#(8)*#P$+(,&*&$?(&/(&$'((,&*&$A((
$%#&$'((28&"/#(8)*#P$+(&$'((,&*&$A(&/(,&*&$?V(
( ( ( ( (1"#80-+"7$o/;(8/#+&;*"#&(/#(,&*&$U+(;/0$+("#(&)$(&$;#*;=6V(
( ( ( I*(#1%+3*#!&#,$..(,)(8(1#/(P*<+6
Information Modeling and Relational Databases: Answers (odd)–71

Exercise A1 (Appendix A)

1. B C F G I

3. “709T” sounds like “seven oh ninety”. Consequently most customers wrote it as “7090”. So
IBM renamed it to agree with common practice.

Exercise B1 (Appendix B)

1.
B-%@"#B+,+8$ C"-;"# 0"&1"#
fjWkS2jJkh
'(>%1". '($8#&,-". '(>%1". fjCkS2jekh
*$2%)2P2/,$ *$2%)

B+,#$*R& e"-,3" C,3" Z))*>"


J%&$-%@"#!
'(&,-". C"-;"#! C"-;"#! '(&#.
:,$2;%#&28&1"# /,$

A"*R/+
'>-M.
/,$
<,33C,3" B=%#+
J%&$-%@"#! '(&,-".
=3,9$

!2'()2e"-,3"C"-;"#2*-"'2C"-;"#21)$2*$2%)20"&1"#2geg(
!2'()2C,3"C"-;"#20-"'2C"-;"#21)$2*$2%)20"&1"#2gCg(
!2'()"J%&B-%@"#20-"'2C"-;"#21)$2/,$2B-%@"#B+,+8$2gJg(
!2'()2<,33C,3"J%&B-%@"#20-"'2J%&B-%@"#2'+3"0-"'2C,3"C"-;"#21)$2/,$2A"*R/+2cT2`da(

Exercise C1 (Appendix C)

1. (a) &(0(,)(<$;+/#("%$'(2<<0"8*#&(
7*(%((%g(H(?Ab(
(((+.8(<$;+/#(!.#
(( 1&(0(,)(<$;+/#("%$'(,<$*I+(
# # # #7*(%((x0*#P-*P$v(K(LE#P0"+)L6(
(((+.8(<$;+/#(!.(
( 1&(0(,)(<$;+/#("%$'(,<$*I+(
( ( ( (7*(%((x0*#P-*P$v(K(LT*<*#$+$L6(
(b) &(0(,)(8!&)!.,)(<$;+/#("%$'(,<$*I+(
7*(%((x0*#P-*P$v(!.((
1&(0(,)(x0*#P-*P$v("%$'(,<$*I+(
(7*(%((<$;+/#(K(Le-'"$L6(
(c) &(0(,)(8!&)!.,)(<$;+/#("%$'(,<$*I+(8(
7*(%((.$)((/!&)&((
1&(0(,)(x0*#P-*P$v("%$'(,<$*I+(
(7*(%((<$;+/#(K(L>);"+L(
((((+.8(x0*#P-*P$v(.$)(!.(
1&(0(,)(x0*#P-*P$v("%$'(,<$*I+(
(7*(%((<$;+/#(K(8V<$;+/#66(
Information Modeling and Relational Databases: Answers (odd)–72

1.1 (d)####&(0(,)#'+/1<$;+/#6(
"%$'#,<$*I+(
1%$23#45#x0*#P-*P$v#
*+6!.1#,$2.)=E:#K(?#
aliter: &(0(,)(<$;+/#("%$'(,<$*I+(8(
# # 7*(%((?(K(
(( 1&(0(,)(,$2.)1G6("%$'(,<$*I+(
((( (7*(%((x0*#P-*P$v(K(8Vv0*#P-*P$v6(
(e) &(0(,)(8!&)!.,)(<$;+/#("%$'(,<$*I+(8(
7*(%((.$)((/!&)&(
(1&(0(,)(x0*#P-*P$v("%$'(,<$*I+(
((7*(%((<$;+/#(K(8V<$;+/#(
(((((+.8(x0*#P-*P$v(!.(
(1&(0(,)(x0*#P-*P$v("%$'(,<$*I+(
((7*(%((<$;+/#(K(L>);"+L66(
(f) &(0(,)(8!&)!.,)(<$;+/#("%$'(,<$*I+(8(
7*(%((.$)((/!&)&(
(1&(0(,)(x0*#P-*P$v("%$'(,<$*I+(
((7*(%((<$;+/#(K(8V<$;+/#(
(((((+.8(x0*#P-*P$v(.$)(!.(
(1&(0(,)(x0*#P-*P$v("%$'(,<$*I+(
((7*(%((<$;+/#(K(L4*7"@L66(
(g) &(0(,)(<$;+/#("%$'(,<$*I+(
1%$23#45(<$;+/#(
*+6!.1(,$2.)1G6(K(
(1&(0(,)(,$2.)18!&)!.,)(x0*#P-*P$v6("%$'(,<$*I+6(
(h) &(0(,)(<$;+/#("%$'(,<$*I+(
1%$23#45(<$;+/#(
*+6!.1(,$2.)1G6(HK(C(
(i) &(0(,)(8!&)!.,)(<$;+/#("%$'(,<$*I+(8(
7*(%((<$;+/#(OH(L4*7"@L(
(((+.8(.$)((/!&)&(
(1&(0(,)(x0*#P-*P$v("%$'(,<$*I+(
((7*(%((<$;+/#(K(8V<$;+/#(
(((((+.8(x0*#P-*P$v(.$)(!.(
(1&(0(,)(x0*#P-*P$v("%$'(,<$*I+(
((7*(%((<$;+/#(K(L4*7"@L6(
($%(<$;+/#(K(L4*7"@L((
+.8(x0*#P-*P$v(.$)(!.(
(1&(0(,)(x0*#P-*P$v("%$'(,<$*I+((
((7*(%((<$;+/#(K(8V<$;+/#66(
(j) &(0(,)(<$;+/#("%$'(2<<0"8*#&(8(
7*(%((%g(K((1&(0(,)('+/1%g6("%$'(2<<0"8*#&(
(7*(%((+$J(K(8V+$J6(
Information Modeling and Relational Databases: Answers (odd)–73

1.1 (k) &(0(,)(8!&)!.,)(x0*#P-*P$v("%$'(,<$*I+(8(


7*(%((.$)((/!&)&(
(1&(0(,)(<$;+/#("%$'(,<$*I+(
((7*(%((<$;+/#(!.(
(1&(0(,)(<$;+/#("%$'(2<<0"8*#&(
((7*(%((+$J(K(LYL6(
(((((+.8(<$;+/#(.$)(!.(
(1&(0(,)(<$;+/#("%$'(,<$*I+(
((7*(%((x0*#P-*P$v(K(8Vv0*#P-*P$v66(

(l) g (m) none (n) b (o) d (p) I

(q) f (r) none (s) e (t) c

3. C

5.
<B @@@@@@@@@@<? <B@Q@`"4="./10318"&41B
<?@Q@`"4="./10318"&41?

<B@Q@<? lB<B1∩1<?D Q11l`#


Q11l<?
,*(,-#.$)#(/!&)&#
( ( 1&(0(,)(S$J&$#+"/#*0(-#"j-$#$++(8/#+&;*"#&(7"/0*&"/#U(
( ( ("%$'(Y$'.$;+)"<(+&(8D(Y$'.$;+)"<(+&(9(
( ( (7*(%((8V&$*'(O(9V&$*'(
( ( ((((+.8(8V'$'.$;(K(9V'$'.$;(
( ( 1%$23#45(8V&$*'D(9V&$*'(
( ( *+6!.1#,$2.)1G6(K(
( ( ( ( 1&(0(,)#,$2.)1G6("%$'(Y$'.$;+)"<(
( ( ( ( (7*(%((&$*'(K(8V&$*'6(
( ( (((+.8#,$2.)1G6(K(
( ( ( ( 1&(0(,)#,$2.)1G6("%$'(Y$'.$;+)"<(
( ( ( ( (7*(%((&$*'(K(9V&$*'6(6(
(
Exercise D1 (Appendix D)
(
1.1 (a) select person
from Speaks
group by person
having count( * ) <= all
( select count( * )
from Speaks
group by person)
!
(b) select person
from Speaks
group by person
having count( * ) >= all
Information Modeling and Relational Databases: Answers (odd)–74

( select count( * )
from Speaks
group by person)

1.1 (c) select gender


from Applicant
group by gender
having avg( IQ ) >= all
( select avg( IQ )
from Applicant
group by gender)

(d)1 select gender


from Applicant
group by gender
having max( iq ) - min( iq ) >= all
( select max( iq ) - min( iq )
from Applicant
group by gender)

or alternatively:

select top 1 a1.gender


from Applicant as a1 join Applicant as a2
on a1.gender = a2.gender
and a1.iq > a2.iq
order by a1.iq-a2.iq desc

3.1 (a) select top 5 productId, productName, unitsInStock


from Product
order by unitsInStock desc

(b) select top 5 with ties productId, productName, unitsInStock


from Product
order by unitsInStock desc

(c)1 select productId, productName, unitPrice


from Product
where unitPrice in
(select top 5 unitPrice from Product
order by unitPrice desc)
order by unitPrice desc

(d)1 select top 10 percent productId, productName, unitsInStock


from Product
where unitsInStock > 0
order by unitsInStock desc
Information Modeling and Relational Databases: Answers (odd)–75

3.1 (e) select productId, productName, unitsInStock,


row_number( ) over ( order by unitsInStock desc ) as row,
rank( ) over ( order by unitsInStock desc ) as rank,
dense_rank( ) over ( order by unitsInStock desc ) as dense_rank
from Product
where unitsInStock > 100
order by unitsInStock desc

Exercise E1 (Appendix E)

1.1 (a) create view StudentScore as


select studentNr, studentName, testScore, examScore,
( testScore + examScore ) as totalScore from Student

(b) with studentScore as


( select studentNr, studentName, testScore, examScore,
( testScore + examScore ) as totalScore from Student )
select * from studentScore
where totalScore < 50

(c) create table Student2 (


studentNr int not null primary key,
studentName varchar( 50 ) not null,
testScore int not null,
examScore int not null,
totalScore as testScore + examScore ) -- SQL Server syntax
(

You might also like