diff --git a/init.sql b/init.sql index 62d0ca5..643e219 100644 --- a/init.sql +++ b/init.sql @@ -123,4 +123,27 @@ create or replace view arcore as st_dwithin(td.geog, st_point(45.622779, 9.276274), 20) -- se passo a 20 metri dal Tamoil and st_dwithin(td2.geog, st_point(45.631299, 9.308985), 30) -- e se passo a 30 metri dalla rotatoria per arcore ) +); + +create or replace view monticello as +( + select duration, + distance, + pace_kmh, + start_time, + end_time, + start_location, + end_location, + training_id + from training_info ti + where ti.training_id in ( + select td.training_id + from training_data td join training_data td2 on (td.training_id = td2.training_id) join training_data td3 on (td.training_id = td3.training_id) + where + distance < 61 and + end_location = 'Bicocca' and + st_dwithin(td.geog, st_point(45.622779, 9.276274), 20) -- se passo per il Tamoil + and st_dwithin(td2.geog, st_point(45.631299, 9.308985), 30) -- e se passo a 30 metri dalla rotatoria per arcore + and st_dwithin(td3.geog, st_point(45.705275, 9.305889), 20) -- e se passo a 20 metri dalla fontanella di Monticello + ) ); \ No newline at end of file