10

I'm creating a MySQL Script that runs on a record and pulls associated records from a series of other tables, which is super useful but in DBeaver the results come back as tabs that only have the name of the table the results come from, which is very useful but sometimes having the tab display exactly what the result is would be so much more useful.

Is there a way to specify in the SQL script what the result should be named that is picked up by DBeaver so it gets displayed as the tab name?

In DBeaver, if I execute the following script (Opt+X):

SELECT *
FROM
  partnerships;

SELECT id, name, owner_id
FROM
  partnerships
WHERE
  name LIKE '%wp%';

The results for both queries come up in two different tabs at the bottom of the DBeaver screen, one would be named partnerships and the other partnerships-1. What I'm asking is, if there is a way to make those tabs something more meaningful to me, like All Partnerships and WP Partnerships.

Dri
  • 492
  • 4
  • 13
  • It's not clear what you are asking here. Consider posting a minimal example of what you've tried and a description of the actual results and how they differ from what you're trying to achieve. – James Nov 02 '17 at 18:59
  • did you try `select * from partnerships as Some_other_name_here`? – Psi Nov 03 '17 at 20:49
  • Yes, that unfortunately did not work, DBeaver just comes back saying there's an error in the SQL. – Dri Nov 03 '17 at 23:41

1 Answers1

25

Turns out, you can actually define the title with a SQL comment in front of the query. Such as:

-- title: WP Named Partnerships
SELECT id, name, owner_id
FROM
  partnerships
WHERE
  name LIKE '%wp%';

This will make it so that WP Named Partnerships will be the title of the results tab.

Dri
  • 492
  • 4
  • 13
  • 1
    that is the title, any other options to disable creating tabs for selects? i want to show the last select results only – Dee Dec 04 '20 at 03:58
  • It doesn't work for me on MySQL Workbench 8.0.22 Community on Mac. – mauronr Mar 17 '23 at 12:58