Making Ad Hoc SQL Tables From Org Tables

This is the coolest thing. Charles Choi—who contributions I’ve written about several times—has a really surprising post on turning Org tables into ad hoc SQL tables. There are a couple of things that make this a worthwhile endeavor:

  1. It’s easy to do
  2. SQL queries that you make on the SQL table are output as a RESULTS block just like any other Org Babel invocation.

If you’re used to using SQL to query a database table and generate new tables or other results, this a a really handy thing. Choi has an example of a query on a simple table that would hard to do otherwise. The SQL table is held in memory and no actual database is generated, just a table corresponding to the Org table but you can make normal SQL queries on that table and export the results to your Org file.

For those who are familiar with SQL spells this is a tremendous capability. You can operate on “normal” Org tables in the same way you do on SQL database tables. Take a look at Choi’s post and his example to see how handy this can be.

This entry was posted in General and tagged , . Bookmark the permalink.