SHARE
TWEET

Untitled

a guest Jun 19th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT country_code, size,
  2.   CASE WHEN size > 50000000
  3.             THEN 'large'
  4.        WHEN size > 1000000
  5.             THEN 'medium'
  6.        ELSE 'small' END
  7.        AS popsize_group
  8. INTO pop_plus      
  9. FROM populations
  10. WHERE year = 2015;
  11.      
  12. Select name, continent, geosize_group, popsize_group
  13. -- 1. From countries_plus (alias as c)
  14. From countries_plus as c
  15.   -- 2. Join to  pop_plus (alias as p)
  16.   inner Join pop_plus as p
  17.     -- 3. Match on country code
  18.     on c.code = p.country_code
  19. -- 4. Order the table    
  20. order by geosize_group;
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top