HACKER Q&A
📣 jstx1

What is your workflow and tips for executing and storing SQL queries?


Just realized that I'm copying and pasting to and from a scratch file a bit too often and there must be a better way.

What tools and workflows do you use to interact with your database? Where and how do you store queries that you'll reuse later?


  👤 gregjor Accepted Answer ✓
As views. Relational databases have supported storing queries for a long time. If you need to have parameters for queries use stored procedures. You can keep the source code for views and procedures in text files in a git repository like any other source code.

👤 danecek099
For a DB manager, I use DBeaver, and in the navigation, there is Project->Scripts folder, where I keep most queries which I've written over the past few years and feel like I would need again.