Interactive SQL Queries With Org-mode

Marcin Borkowski (mbork) always has interesting posts that often give me good ideas. Recently, he posted on using Org-mode for SQL. I haven’t had to deal with SQL for a long time and I was never a heavy user so any complicated query always took me multiple tries. If, like me, you’re an interactive programming aficionado, what you’d like to do is to be able to build up your query piece by piece. SQL certainly doesn’t lend itself to interactive programming but Borkowski found a way. Actually, it’s pretty obvious once you see it.

His idea is to execute the query from inside an Org Babel block. He can continually execute and refine the query until he gets what he wants. The nice thing is that your last attempt doesn’t go away. It’s still there to edit and try again.

Take a look at Borkowski’s post for the details and a worked example. The post is worth reading if only to see his definition of “toy editor.”

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