SHARE
TWEET

Untitled

a guest May 21st, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE OR REPLACE VIEW Stddevservice AS
  2. SELECT area_name, STDDEV_SAMP(col) AS "stddev_services"
  3. FROM ((SELECT area_name, retail_trade AS col FROM cyclability.businessstats JOIN cyclability.neighbourhoods USING (area_id))
  4.   UNION ALL
  5.   (SELECT area_name, acc_food AS col FROM cyclability.businessstats JOIN cyclability.neighbourhoods USING (area_id))
  6.   UNION ALL
  7.   (SELECT area_name, health_social_assist AS col FROM cyclability.businessstats JOIN cyclability.neighbourhoods USING (area_id))
  8.   UNION ALL
  9.   (SELECT area_name, edu_and_training AS col FROM cyclability.businessstats JOIN cyclability.neighbourhoods USING (area_id))
  10.   UNION ALL
  11.   (SELECT area_name, arts_recreation AS col FROM cyclability.businessstats JOIN cyclability.neighbourhoods USING (area_id))
  12. )row_wise_table
  13.  
  14. GROUP BY area_name
  15. ORDER BY area_name
  16.  
  17.  
  18. CREATE OR REPLACE VIEW Avgstddevservice AS
  19. SELECT AVG(stddev_services) AS “avg_stddev”
  20. FROM Stddevservice
  21.  
  22.  
  23.  
  24.  CREATE OR REPLACE VIEW Servicebalance AS
  25.  SELECT area_name, stddev_services - avg_stddev
  26.  FROM Stddevservice
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top