Database Reference
In-Depth Information
Los Angeles | 2 |
199390.900371205
(488 rows)
4. Now,askPostGISforthecitycountandthetotalpopulationineachstateby
executing the following code:
postgis_cookbook-# SELECT s.state,
COUNT(*) AS city_count, SUM(pop_2000) AS
pop_2000 FROM
chp03.states AS s
JOIN chp03.cities AS c
ON ST_Intersects(s.the_geom,
c.the_geom)
WHERE c.pop_2000 > 0 -- NULL values
is -9999 on this field!
GROUP BY s.state
ORDER BY pop_2000 DESC;
state | city_count |
pop_2000
----------------------+----------------+---------
California | 470 |
27380349
Texas | 1182 |
15738629
New York | 613 |
12139544
...
Wyoming | 96
| 334624
Delaware | 56
| 214413
Vermont | 48
| 154831
(51 rows)
5. Asafinaltest,useaspatialjointoupdateanexistingtable.Youneedtoadd
theinformationinthe state_fips fieldtothe earthquake table,fromthe
Search WWH ::




Custom Search