Heroku comes with nice database backup tools, both command line and web based. But how to export results of an SQL query?

Heroku provides Data Clips. Data clips are a web interface for heroku database. To create a data-clip, go to Data Clip dashboard at https://dataclips.heroku.com/ You can login with your heroku username and password. On dashboard, click "Create Data Clip"

Then type in a name to identify the data clip, select the database and enter SQL in the sql's filed.

Click create data clip

Done. Your data-clip is ready

On top tight, the drop-down menu allows us to export to XLS, CSV and JSON, tweet to twitter and share via Google drive. The URL in the text box could be sent to anyone, to see the data.

Under settings, you can set different attributes and permissions. For Hobby plans, the data clip is publicly viewable

Data clip returns up to 100,000 rows of data.