![]() |
Your first Spatial SQL queries |
2011 January 28 |
Previous Slide | Table of Contents | Next Slide |
SELECT COD_REG, REGIONE, ST_Area(Geometry) FROM reg2001_s; |
SELECT COD_REG AS code, REGIONE AS name, ST_Area(Geometry) / 1000000.0 AS "Surface (sq.Km)" FROM reg2001_s ORDER BY 3 DESC; |
SELECT COD_REG AS code, REGIONE AS name, ST_Area(Geometry) / 1000000.0 AS "Surface (sq.Km)", POP2001 / (ST_Area(Geometry) / 1000000.0) AS "Density: Peoples / sq.Km" FROM reg2001_s ORDER BY 4 DESC; |
All right, you have now acquired a
basic SQL / Spatial SQL knowledge.
You are now ready to confront yourself with most complex and powerful queries: but this requires building a serious database. Do you remember ? for now we where simply using Virtual Shapefiles tables; i.e. the faint imitation of real Spatial tables (internally stored). So during the next steps we'll first create and populate a well designed DB (not a so trivial task), and then we'll come again to see most complex and sophisticated SQL queries. |
Previous Slide | Table of Contents | Next Slide |
![]() | Author: Alessandro Furieri a.furieri@lqt.it |
This work is licensed under the Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license. | |
![]() |
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. |