The SQL query secondary tab opens by default when you make a connection to a server from the Home screen. It includes a query editor area and a toolbar. You can enter SQL statements directly into the query editor area. 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 query editor, click Save SQL to Snippets List () from the SQL query toolbar, enter a name (optional), and click . The following figure shows the main elements of a query tab.
Executing a 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 Schema Palette. The item name will be inserted into the SQL Query panel.
The SQL editor has several configurable panels and tabs, as shown in the previous figure.