SQL Generation
DBeaver provides the functionality to automatically generate SQL scripts, streamlining your SQL scripting process. This feature is accessible from two main areas within the application: the Data Editor and the Database Navigator.
You can automatically generate SQL statements based on the selected database object in the Data Editor. To do this:
-
Right-click on the selected database object.
-
Click Generate SQL.
-
Choose one of the SQL commands from the context menu that appears.
-
The generated SQL statement will appear in a new window for you to review and copy.
You can also generate SQL scripts directly from the Database Navigator. To do this:
-
Right-click on a database object in the Database Navigator.
-
Navigate to Generate SQL.
-
Choose the type of SQL statement you want to generate.
-
The generated SQL statement will appear in a new window for you to review and copy.
In the opened window, you have options to further customize your generated SQL script.
Option | Description |
---|---|
Use the fully qualified names | Includes [schema name].[table name] in table references. |
Compact SQL | Condenses SQL script into a single line. |
Separate foreign keys | Isolates foreign key definitions in the script. |
Exclude auto-generated columns | Omits automatically generated columns from the script. |
Use custom data/time format | Customizes date and time formats in the script. |
Show comments | Adds comments to the script for readability. |
Show permissions | Includes permission settings in the script. |
Show full DDL | Adds a comprehensive Data Definition Language section to the script. |
Show partitions DDL | Incorporates partitioning information into the DDL section of the script. |
Use explicit type cast | Adds explicit type casting for SQL values in the script. |
Add CAST to parameters definition |
Adds explicit data type conversion to parameter definitions in the script. |
Note: The availability of these settings may vary depending on the database you are using.
DBeaver streamlines your database navigation tasks with its capability to automatically generate and execute SELECT
statements. This functionality is especially useful when you are working in the Database Navigator.
To read data in SQL Console:
- Navigate to the Database Navigator and identify the database object you want to read.
- Right-click on the chosen database object.
- Select Read data in SQL console.
- A SQL console opens, executing the query and fetching all relevant rows.
DBeaver offers two methods for saving the SQL queries you've executed:
-
Save As: Accessible through the SQL console's context menu, this option allows you to save the SQL query after specifying a file name.
-
Save as Script: Also found in the SQL console's context menu, this function saves the query immediately as a numbered script, without prompting you for a file name.
Tip: Pressing Ctrl+S will transform the SQL console into a SQL editor, enabling more extensive modifications.
-
Views
-
Search
-
Projects
- Sample Database
-
Database Connections
- Edit Connection
- Invalidate/Reconnect to Database
- Disconnect from Database
- Change current user password
- Advanced settings
- Cloud configuration settings
- Local Client Configuration
- Connection Types
- Configure Connection Initialization Settings
- Tableau integration
- Transactions
- Drivers
- Tasks
- Cloud Explorer
- Cloud Storage
- Classic
- Cloud
- Changing interface language
- DBeaver extensions - Office, Debugger, SVG
- Installing extensions - Themes, version control, etc
- User Interface Themes
- Command Line
- Reset UI settings
- Reset workspace
- Troubleshooting system issues
- Posting issues
- Log files
- JDBC trace
- Thread dump
- Managing connections
- Managing variables
- Managing drivers
- Managing preferences
- Managing restrictions
- Windows Silent Install
- Snap installation