In this area, you can enter SQL statements directly. The statements entered can be saved to a file or snippet for later use. At any point, you can also execute the statements you have entered.
To save a snippet of code entered into the SQL Query panel,
Save SQL to Snippets List icon in
the Snippets panel, enter a name (optional), and click
OK. The snippet can be inserted into the
SQL Query panel at any time by double-clicking the snippet in
the SQL Snippets panel.
SELECT query will display the
associated result set in the SQL View panel, directly below the
SQL Query panel. These cells are editable if MySQL Workbench is able
to determine how, as for example they are editable if a Primary
or Unique key exists within the result set. If not, MySQL Workbench
will display a "read-only" icon at the bottom-right corner of
the SQL View panel, and hovering the mouse cursor over this icon
will provide a hint as to why it's not editable.
To quickly enter the name of a table, view, or column, double-click the item in the Schemata Palette. The item name will be inserted into the SQL Query panel.
The SQL Editor has several configurable panels and windows, as described in the screenshot above.
The Output and History panel is located at
the bottom of MySQL Workbench. Its select box includes the
The Action Output panel displays a summary of the communication between the script and the server, and can refer to errors or general information. Each message displays the time, action, and server response. This output is useful for troubleshooting scripts.
The Text Output panel displays a textual representation of the query, as displayed using the MySQL Console. Use Query, Execute (All or Selection) to Text to send output to this panel.
The History panel provides a history of SQL operations carried out. The time and SQL code for each operation is recorded. To view the executed SQL statement, click the time, and the SQL code executed will be displayed in the SQL column.
The results area of the screen shows the results from executed statements. If the script contains multiple statements, a result tab will be generated for each statemented that returned results.
The results panel offers the following options:
Result Set Filter: performs a case-insensitive search of all cells. It automatically refreshes, and there is also the refresh button to perform this action manually.
Export: Writes a result set to a CSV, HTML, or XML file as required.
Wrap Cell Content: If the contents of a cell exceeds the cell width, then the data will be cut off with an ellipses. This option will instead wrap the contents within the cell, and adjust the cell height accordingly.
The "Refresh" button automatically adjusts the column width to match the longest string one of its cells. You may also manually adjust the column width.