Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to define the names of the result tabs names in an SQL Script in DBeaver?

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.

like image 406
Dri Avatar asked Nov 02 '17 17:11

Dri


1 Answers

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.

like image 95
Dri Avatar answered Nov 09 '22 09:11

Dri