MySQL Workbench Manual  /  ...  /  Query and Edit Menus

8.1.3 Query and Edit Menus

When an SQL query tab is selected, the most important items on the main menu bar are the Query and Edit menus.

SQL Query Menu

The Query menu features the following items:

  • Execute (All or Selection): Executes all statements in the SQL Query area, or only the selected statements.

  • Execute (All or Selection) to Text: Executes all statements in the SQL Query area, or only the selected statements, and displays it in plain text like the standard MySQL command line console.

  • Execute Current Statement: Executes the current SQL statement.

  • Execute Current Statement (Vertical Text Output): Executes all statements in the SQL Query area, or only the selected statements, and displays it in plain text like the MySQL command line console does vertically (\G).

  • Explain Current Statement: Describes the current statement by using the MySQL EXPLAIN statement.

  • Visual Explain Current Statement: Visually describes the current statement, based on EXPLAIN information provided by MySQL Server 5.6 and above. MySQL Workbench parses the EXPLAIN (JSON) output from MySQL server 5.6+, and outputs a visual representation.

    For additional information about Visual Explain, see Section 7.4, “Visual Explain Plan” and Section 7.5, “Tutorial: Using Explain to Improve Query Performance”.

  • Stop: Stops executing the currently running script.

  • Stop Script Execution On Errors: If enabled, MySQL Workbench stops executing the a query if errors are found. It can be enabled/disabled from this menu.

  • Limit Rows: By default, the number of returned rows (LIMIT) is 1000. Values defined here affects subsequent statements. The number ranges from 10 to 50000, and "Don't Limit".

  • Collect Performance Schema Stats: Provides data to the Query Stats result set view, which includes statement specific information about Timing, Rows processed, Temporary tables, Joins per type, Sorting, and Index usage.

  • Collect Resultset Field Metadata: Provides data to the Form Editor and Field Types result set views.

  • Reconnect to Server: Reconnects to the MySQL server.

  • New Tab to Current Server: Creates a duplicate of the current SQL Editor tab.

  • Auto-Commit Transactions: Enable to auto-commit transactions.

  • Commit Transaction: Commits a database transaction.

  • Rollback Transaction: Rolls back a database transaction.

  • Commit Result Edits: Commits any changes you have made to the server.

  • Discard Result Edits: Discards any changes you have made.

  • Export Results: Exports result sets to a file. Selecting this option displays the Export Query Results to File dialog. The dialog enables you to select which result set you wish to export, the file format (CSV, HTML, XML), and the name and location of the output file. Then click Export to export the data.

Edit Menu

The Edit menu provides the Format submenu. The Format submenu includes the following menu items:

  • Beautify Query: Reformats the query selected in the query tab and lays it out in nicely indented fashion.

  • UPCASE Keywords: Converts keywords to uppercase in the currently selected query in the query tab.

  • lowercase Keywords: Converts keywords to lowercase in the currently selected query in the query tab.

  • Un/Comment Selection: Comments the lines currently selected in the query tab. If the lines are already commented, this operation removes the comments.

  • Auto-complete: Triggers the auto-completion wizard. This is enabled (and triggered) by default, and can be disabled with Preferences, SQL Editor, Automatically Start Code Completion. Auto-completion will list functions, keywords, schema names, table names and column names.