with b as (select population, zipcode from nyc_zips limit 30)
select
a.complaint_type,
a.incident_zip,
b.population
from
nyc_311 a
left join b on a.incident_zip = b.zipcode
limit
5
with a as (
select
complaint_type,
incident_zip
from
nyc_311
limit
30
)
select
a.complaint_type,
a.incident_zip,
b.population
from
a
right join nyc_zips b on a.incident_zip = b.zipcode
limit
5
with a as (
select
complaint_type,
incident_zip
from
nyc_311
limit
30
), b as (
select
population,
zipcode
from
nyc_zips
limit
30
)
select
a.complaint_type,
a.incident_zip,
b.population
from
a full
outer join b on a.incident_zip = b.zipcode
limit
100
with a as (
select
neighborhood
from
nyc_neighborhoods
limit
2
), b as (
select
population,
zipcode
from
nyc_zips
limit
2
)
select
a.neighborhood,
b.population
from
a
cross join b
with a as (
select
neighborhood
from
nyc_neighborhoods
limit
2
), b as (
select
population,
zipcode
from
nyc_zips
limit
2
)
select
a.neighborhood,
b.population
from
a,
b
with a as (
select
neighborhood
from
nyc_neighborhoods
limit
2
), b as (
select
population,
zipcode
from
nyc_zips
limit
2
)
select
a.neighborhood,
b.population,
b.population / 1000 as calculation
from
a,
b
with a as (
select
ogc_fid,
zipcode :: text
from
nyc_mappluto
)
select
count(a.ogc_fid),
b.zipcode
from
nyc_zips b
join a using(zipcode)
group by
b.zipcode
order by
count(a.ogc_fid) desc
with a as (
select
ogc_fid,
zipcode :: text
from
nyc_mappluto
order by
ogc_fid desc
limit
5000
), c as (
select
ogc_fid,
zipcode
from
nyc_2015_tree_census
order by
ogc_fid desc
limit
5000
)
select
count(a.ogc_fid) as buildings,
-- count(c.ogc_fid) as trees,
b.zipcode
from
nyc_zips b
join a using(zipcode)
-- join c
-- using(zipcode)
group by
b.zipcode
order by
count(a.ogc_fid) desc
with a as (
select
ogc_fid,
zipcode :: text
from
nyc_mappluto
order by
ogc_fid desc
limit
5000
), c as (
select
ogc_fid,
zipcode
from
nyc_2015_tree_census
order by
ogc_fid desc
limit
5000
)
select
-- count(a.ogc_fid) as buildings,
count(c.ogc_fid) as trees,
b.zipcode
from
nyc_zips b
-- join a using(zipcode)
join c using(zipcode)
group by
b.zipcode
-- order by count(a.ogc_fid) desc
order by
count(c.ogc_fid) desc
with a as (
select
count(ogc_fid) as buildings,
zipcode :: text
from
nyc_mappluto
group by
zipcode
),
b as (
select
count(ogc_fid) as trees,
zipcode
from
nyc_2015_tree_census
group by
zipcode
)
select
a.buildings,
b.trees,
c.zipcode
from
nyc_zips c
join a using(zipcode)
join b using(zipcode)
order by
b.trees desc