Is there any way to add some line numbers in the result grid in MySQL Workbench?
E.g. (red numbers):
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.
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.
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.
The Output is located at the bottom of MySQL Workbench. Its select box includes the Action Output , History Output , and Text Output options.
For the newer versions you should go to Edit -> Preferences -> Fonts and then find Resulset Grid and choose the size you want.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With