Skip to content

SQL Editor

DBeaverDevOps edited this page Jun 19, 2024 · 16 revisions

Table of contents

Overview

SQL Editor supports autocomplete, syntax highlight, statement execution, script execution, and execution plan for some databases.

Shortcuts

Shortcut Description
Ctrl+Enter Execute SQL statement
Ctrl+</kbd> or Ctrl+Shift+Enter Execute SQL statement in new tab
Alt+X Execute script
Shift+Ctrl+E Show execution plan
Alt+T Open SQL Editor in separate browser tab
Shift+Ctrl+F Format script
Ctrl+Z or CMD+Z Undo
Ctrl+Y or Ctrl+Shift+Z or Shift+CMD+Z or CMD+Y Redo
Esc+Tab Remove focus from the SQL Editor

Statement Execution

Place the cursor on the line with the statement or select part of the script to execute the statement. Click on the Run icon in the left toolbar or use the Ctrl+Enter shortcut. The result of the statement execution will be shown under the script editor area. Results will be grouped (Result - 1 <1>, Result - 1 <2>) if statement execution is finished with more than one result.

Script Execution

Click on the Script icon in the left toolbar or use the Alt+X shortcut to execute the script. The summary result will be shown in the Statistics tab, and results will be shown in separate Result tabs.

Auto and Manual commit

By default, all database connections in the SQL Editor operate in Auto-commit mode, meaning that changes are automatically committed after each SQL statement is executed. To gain precise control over your transactions, you may switch to Manual commit mode.

Switching to Manual commit

In Manual commit mode, you manually determine when to commit or rollback transactions. This mode is essential when batch operations need to be treated as a single unit or when you need to inspect changes before making them permanent.

Here is a table outlining the actions and their corresponding icons in Manual commit mode:

Action Icon Description
Switch to manual commit Click to open a menu for manual transaction control. You will need to Commit or Rollback changes explicitly.
Commit Click after executing SQL statements to save the changes to the database.
Rollback Click to revert changes made by your SQL statements, undoing current transaction changes.
Switch to auto-commit Click to return to Auto-commit mode, where changes are automatically committed.

Tip: After committing in Manual commit mode, performing a Refresh is necessary to see the newly added data in the Result tab.

Limitations of Rollback capabilities

In database management, not all commands support rollback operations. It is crucial to understand that Data Definition Language (DDL) commands—such as CREATE, DROP, or ALTER cannot be reversed with transactions for some databases. This means that once these commands are executed, they cannot be reversed even in manual commit mode.

Important: Always check the transaction support for the specific database you are working with to avoid irreversible operations.

CloudBeaver Documentation

User Guide

Installation

Configuration

CloudBeaver AWS

CloudBeaver Enterprise Edition

Deployment

Clone this wiki locally