(maker4 = maker AND (model4=model OR model4=model2 OR model4=model3))
πmaker
Exercise 2.4.3a
R1 := σbore ≥ 16 (Classes)
class
country
Exercise 2.4.3b
R1 := σlaunched < 1921 (Ships)
R2 := πname (R1)
name
Haruna
Hiei
Exercise 2.4.3c
R1 := σbattle=Denmark Strait AND result=sunk(Outcomes)
R2 := πship (R1)
ship
Bismarck
Hood
Exercise 2.4.3d
R1 := Classes Ships
R2 := σlaunched > 1921 AND displacement > 35000 (R1)
R3 := πname (R2)
name
Iowa
Missouri
Musashi
New Jersey
North Carolina
Washington
Wisconsin
Yamato
Exercise 2.4.3e
R1 := σbattle=Guadalcanal(Outcomes)
Kirishima
Kongo
Ramillies
Renown
Repulse
Resolution
Revenge
Royal Oak
Royal Sovereign
Tennessee
R2 := Ships (ship=name) R1
Exercise 2.4.3f
R1 := πname(Ships)
name
California
Haruna
Hiei
Iowa
Kirishima
Kongo
Missouri
Musashi
New Jersey
North Carolina
Ramillies
Renown
Repulse
Resolution
Revenge
Royal Oak
Royal Sovereign
Tennessee
Washington
Wisconsin
Yamato
Arizona
Bismarck
Duke of York
Fuso
Hood
King George V
Prince of Wales
displacement
Kirishima
32000
8
Washington
37000
9
Exercise 2.4.3g
From 2.3.2, assuming that every class has one ship named after the class.
R1 := πclass(Classes)
Exercise 2.4.3h
R1 := πcountry(σtype=bb(Classes))
Exercise 2.4.3i
R1 := πship,result,date(Battles (battle=name) Outcomes)
Exercise 2.4.4a
πclass,country
South Dakota
Exercise 2.4.4b
πname
Exercise 2.4.4c
πship
Exercise 2.4.4d
σlaunched > 1921 AND displacement > 35000
πname
Exercise 2.4.4e
πname,displacement,numGuns
Exercise 2.4.4f
πname
ρR3(name)
Exercise 2.4.4g
πclass
πclass
Exercise 2.4.4h
πcountry πcountry
Exercise 2.4.4i
(ship=ship2 AND result=damaged AND date < date2)
πship
Exercise 2.4.5
The result of the natural join has only one attribute from each pair of equated attributes. On the
Exercise 2.4.6
Union
If we add a tuple to the arguments of the union operator, we will get all of the tuples of
Intersection
If we add a tuple to the arguments of the intersection operator, we will get all of the
Difference
If we add a tuple to the arguments of the difference operator, we may not get all of the
Projection
If we add a tuple to the arguments of the projection operator, we will get all of the tuples
Selection
If we add a tuple to the arguments of the selection operator, we will get all of the tuples
Cartesian Product
If we add a tuple to the arguments of the Cartesian product operator, we will get all of the
tuples of the original result and possibly additional tuples. The Cartesian product pairs the
Natural Joins
If we add a tuple to the arguments of a natural join operator, we will get all of the tuples
of the original result and possibly additional tuples. The new tuple can only create
Theta Joins
If we add a tuple to the arguments of a theta join operator, we will get all of the tuples of
the original result and possibly additional tuples. The theta join can be modeled by a
Renaming
If we add a tuple to the arguments of a renaming operator, we will get all of the tuples of
Exercise 2.4.7a
If all the tuples of R and S are different, then the union has n + m tuples, and this number is the
maximum possible.
Exercise 2.4.7b
If all the tuples in one relation can pair successfully with all the tuples in the other relation, then
the natural join has n * m tuples. This number would be the maximum possible.
Exercise 2.4.7c
If the condition C brings back all the tuples of R, then the cross product will contain n * m tuples.
Exercise 2.4.7d
Assuming that the list of attributes L makes the resulting relation πL(R) and relation S schema
The minimum number of tuples that can appear in the result occurs when all of the tuples in
πL(R) appear in S. Then the difference has max(n m , 0) tuples.
Exercise 2.4.8
Defining r as the schema of R and s as the schema of S:
1. πr(R S)
Exercise 2.4.9
Defining r as the schema of R
Exercise 2.4.10
πA1,A2…An(R S)
Exercise 2.5.1a
Exercise 2.5.1b
Exercise 2.5.1c
Exercise 2.5.1d
This complex expression is best seen as a sequence of steps in which we define temporary
relations R1 through R4 that stand for nodes of expression trees. Here is the sequence:
Exercise 2.5.1e
Exercise 2.5.2a
πclassbore > 16(Classes)) = ø
The Yamato class violates the constraint.
Exercise 2.5.2b
Exercise 2.5.2c
This complex expression is best seen as a sequence of steps in which we define temporary
relations R1 through R5 that stand for nodes of expression trees. Here is the sequence:
Exercise 2.5.2d
Exercise 2.5.2e
This complex expression is best seen as a sequence of steps in which we define temporary
relations R1 through R5 that stand for nodes of expression trees. Here is the sequence:
Exercise 2.5.3
Exercise 2.5.4
The form of a constraint as E1 = E2 can be expressed as the other two constraints.
Using the “equating an expression to the empty set” method, we can simply say: