Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Line numbering in result grid in MySQL Workbench

Is there any way to add some line numbers in the result grid in MySQL Workbench?

E.g. (red numbers):

enter image description here

I don't want to have to change the SQL query, which I know I can do using tricks like

SELECT @n := @n + 1 `Number of Submissions`,  t.*
FROM (SELECT @n:=0) initvars, 
    ( SELECT COUNT(*) AS count 
          FROM moocdb.submissions 
          GROUP BY user_id 
          ORDER BY count DESC
    ) t

I also don't want to have to export the results.

like image 776
Franck Dernoncourt Avatar asked Jul 23 '14 23:07

Franck Dernoncourt


People also ask

How do I display the result grid in MySQL Workbench?

Here is a simple technique to get back the results grid in MySql WorkBench. Place the text cursor on a query and use the "EXPLAIN command" for the statement under the cursor. That will open the Visual Explain window. In that window you can find Results Grid.

How do I find the row number in MySQL Workbench?

The ROW_NUMBER() function in MySQL is used to returns the sequential number for each row within its partition. It is a kind of window function. The row number starts from 1 to the number of rows present in the partition.

How do I display output in SQL Workbench?

The Output is located at the bottom of MySQL Workbench. Its select box includes the Action Output , History Output , and Text Output options.

How do I extend the result grid in MySQL Workbench?

For the newer versions you should go to Edit -> Preferences -> Fonts and then find Resulset Grid and choose the size you want.


1 Answers

Not sure if that is a good question for SO, but anyway: no this is not possible. Nobody asked for that so far, so, file a feature request at http://bugs.mysql.com to have that in.

like image 73
Mike Lischke Avatar answered Sep 22 '22 00:09

Mike Lischke