-
Notifications
You must be signed in to change notification settings - Fork 0
/
parcel_tract_capacity_intreq_grant_20201221
68 lines (54 loc) · 1.65 KB
/
parcel_tract_capacity_intreq_grant_20201221
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
drop table if exists parcels_capacity_census_tracts_12212020;
create table parcels_capacity_census_tracts_12212020
select
parcel_id
,tod_id_final_alt
,du_base
,du_capacity_50
,du_capacity_50_net
from parcels_pseudo80_capacity_netdist;
alter table parcels_capacity_census_tracts_12212020 add primary key(parcel_id);
alter table parcels_capacity_census_tracts_12212020
add column tod_id_final_alt_bool int(11)
,add column x_coord_sp float
,add column y_coord_sp float
,add column census_tract_id int(11)
,add column geoid10 varchar(11)
;
update parcels_capacity_census_tracts_12212020
set tod_id_final_alt_bool = 0, x_coord_sp = 0, y_coord_sp = 0, census_tract_id = 0, geoid10 = 'na';
update parcels_capacity_census_tracts_12212020 t
inner join 2014_parcel_baseyear_core.parcels p
on t.parcel_id = p.parcel_id
set t.x_coord_sp = p.x_coord_sp
,t.y_coord_sp = p.y_coord_sp
,t.census_tract_id = p.census_tract_id
;
update parcels_capacity_census_tracts_12212020
set tod_id_final_alt_bool = 1 where tod_id_final_alt > 0;
update parcels_capacity_census_tracts_12212020 t
inner join 2014_parcel_baseyear_core.census_tracts c
on t.census_tract_id = c.census_tract_id
set t.geoid10 = c.geoid10
;
select * from parcels_capacity_census_tracts_12212020 where tod_id_final_alt > 0 limit 300;
select * from parcels_capacity_census_tracts_12212020;
select
census_tract_id
,geoid10
,count(*) as parcels
,sum(du_base) as du_base
,sum(du_capacity_50) as du_capacity_50
,sum(du_capacity_50_net) as du_capacity_50_net
from parcels_capacity_census_tracts_12212020
group by
census_tract_id
,geoid10
;
select
tod_id_final_alt
,count(*)
from parcels_pseudo80_capacity_netdist
group by
tod_id_final_alt
;