Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/giswqs/postgis
Spatial Data Management with PostgreSQL and PostGIS https://gishub.org/sdm
https://github.com/giswqs/postgis
data-science database geospatial postgis postgres postgresql
Last synced: 6 days ago
JSON representation
Spatial Data Management with PostgreSQL and PostGIS https://gishub.org/sdm
- Host: GitHub
- URL: https://github.com/giswqs/postgis
- Owner: giswqs
- License: mit
- Created: 2021-03-28T19:33:10.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-08-19T14:39:35.000Z (about 2 years ago)
- Last Synced: 2024-10-24T15:57:15.626Z (14 days ago)
- Topics: data-science, database, geospatial, postgis, postgres, postgresql
- Language: Jupyter Notebook
- Homepage: https://postgis.gishub.org
- Size: 13.2 MB
- Stars: 44
- Watchers: 3
- Forks: 33
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# postgis
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/giswqs/postgis/master)
Spatial Data Management with PostgreSQL and PostGIS https://gishub.org/sdm
## Sample Datasets
- https://github.com/giswqs/data
- [cities.csv](https://github.com/giswqs/postgis/blob/master/data/cities.csv)## Useful Resources
- https://www.w3schools.com/sql/default.asp
## SQL Tutorial
- https://www.scaler.com/topics/sql/
### Change column type
```
ALTER TABLE cities
ALTER COLUMN population TYPE INT
USING population::integer
```### SQL queries for non-spatial data
The examples below use the sample dataset - [cities.csv](https://github.com/giswqs/postgis/blob/master/data/cities.csv)
- `SELECT * FROM cities`
- `SELECT * FROM cities LIMIT 10`
- `SELECT name, country FROM cities`
- `SELECT DISTINCT country FROM cities`
- `SELECT COUNT(DISTINCT country) FROM cities`
- `SELECT MAX(population) FROM cities`
- `SELECT SUM(population) FROM cities`
- `SELECT AVG(population) FROM cities`
- `SELECT * FROM cities ORDER BY country`
- `SELECT * FROM cities ORDER BY country ASC, population DESC`
- `SELECT * FROM cities WHERE country='USA'`
- `SELECT * FROM cities WHERE country='USA' OR country='CAN'`
- `SELECT * FROM cities WHERE country='USA' AND population>1000000`
- `SELECT * FROM cities WHERE country LIKE 'U%'`
- `SELECT * FROM cities WHERE country LIKE '%A'`
- `SELECT * FROM cities WHERE country LIKE '_S_'`
- `SELECT * FROM cities WHERE country IN ('USA', 'CAN', 'CHN')`
- `SELECT * FROM cities WHERE population BETWEEN 1000000 AND 10000000`