Is it possible to execute query where the cursor is placed?


Is it possible in DataGrip to simply run a query where the cursor is placed if editor has multiple queries?

In DataGrip I can not seem to find such option in the "Settings -> Database -> General -> Execute in Console" config. By pressing CMD+Enter in DataGrip it will either show the popup where I need to click Enter again, or will execute all queries, or does some other thing.

In a free MySQL Workbench I can have multiple queries in the same editor and execute different queries by simply moving cursor to specific query and pressing CMD+Enter - this makes working with multiple queries so much faster. No selection needed, no popups where I need to specifically select which query should be executed.



@Walltearer You can configure such behavior


Thank you for the answer, but unfortunately neither of the options do what my question is about.
In my case I am moving cursor between small/medium/big/whatever_the_size queries and by pressing CMD+Enter I want to execute exact query under the cursor, not just smallest or largest one.

Since at the moment the question is not answered, is it possible to remove tag "answered" from it?





Okay, so turns out that "Largest statement" configuration does execute the query on which the cursor is placed.

The naming for this configuration is a bit unfortunate, in my opinion.


It's done to clarify what to do if the subquery is under the caret


Please sign in to leave a comment.