-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitignore
23 lines (20 loc) · 1.39 KB
/
.gitignore
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Answers to the 2nd practical
1: 9.699999809265137
2: 5.935000044107437
3: SELECT postcode, COUNT(chi) FROM demographic GROUP BY postcode;
4: SELECT demographic.first_name,demographic.last_name,demographic.dob,demographic.chi,demographic.postcode, simd.decile FROM demographic, simd WHERE demographic.postcode=simd.postcode;
5: SELECT simd.decile, COUNT(demographic.first_name) FROM demographic, simd GROUP BY simd.decile;
6: SELECT demographic.first_name, demographic.last_name, demographic.chi
FROM demographic
INNER JOIN infection_test_results ON demographic.chi = infection_test_results.chi
WHERE infection_test_results.result='positive';
7:SELECT demographic.first_name, demographic.last_name, biochem_test_results.test, biochem_test_results.result
FROM demographic
INNER JOIN biochem_test_results ON demographic.chi = biochem_test_results.chi
GROUP BY demographic.first_name, demographic.last_name, biochem_test_results.test;
#Important to note that for question 7 it had to use all the values we selected in the select statement since there is no individiual unique field we could have grouped by so we had to use all of it
8: SELECT infection_test_results.chi, COUNT(biochem_test_results.chi)
FROM biochem_test_results
INNER JOIN infection_test_results ON biochem_test_results.chi= infection_test_results.chi
WHERE infection_test_results.chi=biochem_test_results.chi
GROUP BY infection_test_results.chi;