Part 2. Tuple Operators (20 pts)
The subject table below is an adaptation of the Pima Indians Diabetes Database. The subject_id
and city_id columns were added to the original dataset (table).
Also, subjects_old, subjects_temp, cities, and values tables were also added so we can apply
some operations to them.
To know the meaning of each column in the original dataset, please see number 7 in the Pima
Indians Diabetes Database documentation. This will also be helpful for copying / pasting your
answers.
subjects
subject_id city_id preg plas pres skin insu mass pedi age class
2
6 148 72 35
2
3
1 85 66 29
3
2
4 NULL
8 183 64 0
1 89 66 23
5
3 0 137 40 35
0 33.6 0.627
0 26.6 0.351
0 23.3 0.672
94 28.1 0.167
168 43.1 2.288
50 tested positive
31 tested_negative
32 tested_positive
21 tested_negative
33 tested positive
2 5 116 74 0
0
25.6 0.201
30 tested_negative
subjects_temp
subject_id city_id preg
pres skin
mass pedi
35 168
2
116 74 0 0
17
118 84 47 230
7
107 74 00
11
110 92 0 0
37.6 0.191 30
age
2.288 33
25.6 0.201 30
45.8 0.551 31
29.6 0.254 31 tested_positive
tested_negative
class
tested positive
tested_negative
tested_positive
cities
values
city_id
name
value_id
Boolean
0
Phoenix
0
false
1
Tucson
1
true
2
Mesa
3
Tempe
4
Glendale
5
Chandler
NULL
3 78 50 32 88 31 0.248
26 tested_positive
10 115 0 0
35.3 0.134
29 tested_negative
2 197 70 45 543
30.5 0.158
53 tested positive
10
8 125 96 00
0 0.232
54 tested positive
11
0
4 110 92 0
0
37.6 0.191
30 tested_negative
Create the tables for each of the following relational algebra expressions.
Question 2.1 (4 pts)
6(diastolic Blood pressure < 65) subjects
12
3 10 168 74
0
0
38 0.537
34 tested_positive
13
2 10 139 80 0
0 27.1 1.441
57 tested_negative
Question 2.2 (4 pts)
14 NULL
15
1 189 60 23
2 5 166 72 19
846 30.1 0.398
59 tested_positive
175 25.8 0.587
51 tested positive
π (pedi, class) subject
Question 2.3 (4 pts)
subjects_old
subject_id city_id preg plas pres skin insu mass pedi
age class
subjects_old - subjects_temp
16
2
7 100 00 0
30 0.484
32 tested positive
Question 2.4 (4 pts)
17
0
18
1
7 107 74 0
0 118 84 47 230 45.8 0.551
0 29.6 0.254
31 tested positive
values X cities
31 tested positive
19 NULL
20
3
1 115 70 30
103 30 38 83
96
43.3 0.183
34.6 0.529
33 tested_negative
32 tested_positive
Question 2.5 (4 pts)
subjects cities