Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT country_code, size,
- CASE WHEN size > 50000000
- THEN 'large'
- WHEN size > 1000000
- THEN 'medium'
- ELSE 'small' END
- AS popsize_group
- INTO pop_plus
- FROM populations
- WHERE year = 2015;
- Select name, continent, geosize_group, popsize_group
- -- 1. From countries_plus (alias as c)
- From countries_plus as c
- -- 2. Join to pop_plus (alias as p)
- inner Join pop_plus as p
- -- 3. Match on country code
- on c.code = p.country_code
- -- 4. Order the table
- order by geosize_group;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement