-
Notifications
You must be signed in to change notification settings - Fork 0
/
Working_03092020
208 lines (171 loc) · 5.31 KB
/
Working_03092020
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# Exploring Kitsap County component tables
Select * from 2018_parcel_baseyear_working.buildings_20200219_hs where county_id = 35 and building_type_id = 12 and residential_units = 5 and gross_sqft < 2000;
SELECT * FROM kitsap_2018_parcel_baseyear.prep_buildings limit 1000;
SELECT
improv_type
#,bldg_type
,use_desc
,count(id) as records
,sum(residential_units) as hu
,sum(total_sqft) as tot_sqft
,sum(improvement_value) as imp_value
FROM kitsap_2018_parcel_baseyear.prep_buildings
group by
improv_type
#,bldg_type
,use_desc
;
SELECT * FROM kitsap_2018_parcel_baseyear.prep_buildings where use_desc = 'apartments';
SELECT
rp_acct_id
,count(id) as records
,sum(total_sqft) as total_sqft
,sum(improvement_value) as imp_value
FROM kitsap_2018_parcel_baseyear.prep_buildings
where use_desc = 'apartments'
group by
rp_acct_id
;
SELECT * FROM kitsap_2018_parcel_baseyear.buildings limit 1000;
SELECT * FROM kitsap_2018_parcel_baseyear.kitsap_commercial_improvement limit 10;
SELECT * FROM kitsap_2018_parcel_baseyear.main limit 10;
SELECT * FROM kitsap_2018_parcel_baseyear.land limit 10;
SELECT * FROM kitsap_2018_parcel_baseyear.flatats limit 10; #Flattened Assessed value?
SELECT * FROM kitsap_2018_parcel_baseyear.buildings_assessor limit 10;
SELECT * FROM kitsap_2018_parcel_baseyear.buildings_assessor where USE_DESC = 5;
SELECT * FROM kitsap_2018_parcel_baseyear.kitsap_valuation limit 100; #where RealPropertyAccountID = 1431808;
SELECT * FROM kitsap_2018_parcel_baseyear.kitsap_parcel where RealPropertyAccountID = 1010172;
SELECT * FROM kitsap_2018_parcel_baseyear.kitsap_dwelling limit 100; #limit 10; #where RealPropertyAccountID = 1431808;
SELECT * FROM kitsap_2018_parcel_baseyear.kitsap_mobile_home limit 100; #where RealPropertyAccountID = 1431808;
select *
FROM kitsap_2018_parcel_baseyear.buildings_before_delete_not_in_parcels
right join kitsap_2018_parcel_baseyear.buildings
on kitsap_2018_parcel_baseyear.buildings_before_delete_not_in_parcels.building_id = kitsap_2018_parcel_baseyear.buildings.building_id
where kitsap_2018_parcel_baseyear.buildings_before_delete_not_in_parcels.building_id is null;
SELECT
stacked_pin
,count(building_id) as records
FROM kitsap_2018_parcel_baseyear.buildings_before_delete_not_in_parcels
group by stacked_pin
;
SELECT * FROM kitsap_2018_parcel_baseyear.prep_buildings limit 10;
### King
###
SELECT
use_code
,use_code_txt
,count(pin) as records
,sum(residential_units) as hu
,sum(gross_sqft) as tot_sqft
,sum(sqft_per_unit*residential_units) as res_sqft_calc
,sum(improvement_value) as imp_value
FROM king_2018_parcel_baseyear.prep_buildings_1_short
group by
use_code
,use_code_txt
;
SELECT
FROM king_2018_parcel_baseyear.buildings
limit 1000
;
#########
#########
## Exploring Snohomish County component tables
SELECT *
FROM snohomish_2018_parcel_baseyear.prep_buildings_1_20200207
limit 100;
where lrsnum = '1016512';
SELECT *
FROM snohomish_2018_parcel_baseyear.tmp_pud_stacked_with_pin_units
#where LRSN = 1016512
where PUD_Mtr_Ct between 200 and 300
order by PUD_Mtr_Ct
;
SELECT *
FROM snohomish_2018_parcel_baseyear.pudresmeter # Contains PUD_Mtr_Ct
where LRSN = '1016512';
SELECT *
FROM snohomish_2018_parcel_baseyear.snohomish_master
where LRSN = '1016512';
SELECT *
FROM snohomish_2018_parcel_baseyear.snohomish_land
where LRSNum = '1016512';
SELECT *
FROM snohomish_2018_parcel_baseyear.snohomish_improvement
#where UseCode Is Null;
limit 1000;
where LRSNum = '1016512';
SELECT
ImprType
,UseCode
,UseDesc
,count(PIN) as records
,sum(FinishedSquareFeet) as SQFT
,sum(residential_units) as hu
#FROM snohomish_2018_parcel_baseyear.snohomish_improvement
FROM snohomish_2018_parcel_baseyear.prep_buildings_1_20200207
group by
ImprType
,UseCode
,UseDesc
;
SELECT * FROM snohomish_2018_parcel_baseyear.tmp_pud_stacked_with_pin_units t;
SELECT * FROM snohomish_2018_parcel_baseyear.pudresmeter;
##
## base camp
###
ELECT
table_name
#,Engine
#,Version
#,Row_format
,table_rows
#,Avg_row_length
#,Data_length
#,Max_data_length
#,Index_length
#,Data_free
#,Auto_increment
,Create_time
,Update_time
#,Check_time
#,table_collation
#,Checksum
#,Create_options
#,table_comment
FROM information_schema.tables
WHERE table_schema = '2018_parcel_baseyear_working'
order by Update_time desc;
SELECT * FROM 2018_parcel_baseyear_working.imputed_buildings limit 10;
SELECT * FROM 2018_parcel_baseyear_working.buildings_for_imputation limit 10;
SELECT * FROM 2018_parcel_baseyear_working.buildings_20200219_hs limit 10;
SELECT * FROM 2018_parcel_baseyear_working.buildings_20200212_pmc limit 10;
SELECT * FROM 2018_parcel_baseyear_working.buildings limit 10;
create table 2018_parcel_baseyear_working.buildings_20200219_hs_mhs_edit_copy
SELECT *
FROM 2018_parcel_baseyear_working.buildings_20200219_hs
;
SELECT
*
FROM 2018_parcel_baseyear_working.buildings_20200219_hs_mhs_edit_copy
limit 10
;
create table 2018_parcel_baseyear_working.temp_mhs_buildings_20200219_hs_usecode_xtab_summary
SELECT
county_id
,use_code_orig
,count(building_id) as records
,sum(residential_units) as hu
,sum(gross_sqft) as total_sqft
,sum(non_residential_sqft) as nonres_sqft
FROM 2018_parcel_baseyear_working.buildings_20200219_hs_mhs_edit_copy
#FROM 2018_parcel_baseyear_working.buildings_20200219_hs_mhs_edit_copy
group by
county_id
,use_code_orig
order by
county_id
,use_code_orig
;
alter table
SELECT * FROM 2018_parcel_baseyear_working.building_use_generic_reclass_2018_v2 b;