SQL editor allows editing and execution of SQL queries and scripts.
There are two ways to open SQL editor - using "SQL Editor" or "New SQL Editor" commands. These commands are accessible through the main toolbar, main menu, or with shortcuts CTRL+L and CTRL+ALT+L.
"SQL Editor" command opens recent SQL scripts for the currently active connection (active connection name is shown in the main toolbar) or creates a new SQL script (which can be opened later from Project Explorer view). "New SQL Editor" always creates a new script.
When you close the SQL editor it auto-saves. If you want to revert changes - use the appropriate command from context menu.
SQL editor highlights SQL syntax depending on the current database SQL dialect. When you open SQL editor for some connection, DBeaver will try to connect to underlying database. If the database is inaccessible then you won't be able to execute queries.
You may change the active database of current SQL editor by using the main toolbar.
There are two SQL execution modes: query and script.
The query execution command is accessible from the toolbar, context menu, main menu or with shortcut CTRL+Enter.
SQL editor extract current query - the SQL statement under the cursor limited by empty lines or statement delimiter (";" symbol)
Also you may select any part of text - it will be executed as single query.
Query execution usually produces some result set - it will be printed in the "Data Grid" tab. Read more about Result Sets navigation and edit.
Script executes the entire content of the SQL editor or selected text. This command is accessible from the menu, toolbar or with shortcut ALT+X.
SQL editor parses content using the ";" character as a delimiter between statements and then executes these statements consequently.
You may automatically build an execution plan for the current query. This command is accessible from the toolbar or with the shortcut CTRL+SHIFT+Enter.
Driver provider must support execution plan extraction. The Generic driver provider doesn't support this feature.
Execution log tab contains history of all command executed in the current SQL editor.
Read more information about Query Manager.