Repository for Petra's work at ampli Jan-Feb 2019

weather.pgsql 818B

1234567891011121314151617181920212223242526
  1. -------------------------------
  2. -- Querying the weather data --
  3. -------------------------------
  4. -- Get currently operating stations
  5. SELECT agent, network, start_date, end_date, station_name,
  6. lat_dec_deg, long_dec_deg
  7. FROM weather.station_dim
  8. WHERE end_date IS NULL AND
  9. start_date <= to_date('2015-01-01', 'yyyy-mm-dd')
  10. ORDER BY start_date;
  11. -- 1 agent per network and vice versa?
  12. SELECT COUNT(DISTINCT agent) as agents, network
  13. FROM weather.station_dim
  14. GROUP BY network
  15. ORDER BY agents DESC;
  16. -- Get data from station 2006
  17. SELECT record_no, station, temp_date, temp_time, tmax_c, tmin_c,
  18. tgmin, tmean, rhmean
  19. FROM weather.temperature_fact
  20. WHERE station = 2006 AND
  21. temp_date >= to_date('2016-01-01', 'yyyy-mm-dd') AND
  22. temp_date < to_date('2019-01-01', 'yyyy-mm-dd')
  23. ORDER BY temp_date, temp_time;