Configuring Database Queries
In the db command, you can use saved database queries. The name of the saved query is passed to the command as the query parameter. To create or edit a query, go to the Main Menu - Settings - Management - SEARCH ANYWHERE- JDBC Queries section:

To create a new query, click the Create button in the top right corner. To edit a query, click on it in the list. Below is an example of a filled configuration for a JDBC query named click_query:

Click the Save button, and the query will be ready to use in the db command.
Example 1
In this example, the db command uses a saved JDBC query click_query instead of inline SQL, and the database connection is specified through connection=click.
db connection=click query=click_query