Category Archives: PostgreSQL

Importing a Shapefile into PostgreSQL

I tried to import a shapefile to a PostgreSQL database using SPIT in QGIS, but kept getting an error because the gid column already existed in the .dbf. So I used the command line instead: shp2pgsql Downloads/Archive/data_dev.shp > data.sql then … Continue reading

Posted in PostgreSQL | 1 Comment

Taking the top 5 of grouped ranked data in PostgreSQL

Working from a list of my ancestors’ occupations I wanted to list the top 5 occupations in each occupational category per decade, so that given year category description total … 1851 Agriculture Ag Lab 4 1851 Agriculture Farm Bailiff 1 … Continue reading

Posted in PostgreSQL, SQL | Leave a comment

Creating a Rails 3 Project with PostgreSQL and TextMate on a Mac OS X Machine

I was advised to use RVM to manage Ruby on the Mac. Sign up as an Apple developer Download and install XCode Follow the instructions for installing RVM. Install RVM by executing $ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head ) in … Continue reading

Posted in PostgreSQL, Ruby on Rails | Leave a comment