Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  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;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement