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

1 points by jstx1 ↗ HN
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?

2 comments

[ 3.3 ms ] story [ 7.8 ms ] thread
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.
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.