# Working with DDL definitions

Procedure: Enable the Database Tools and SQL plugin

This functionality relies on the  Database Tools and SQL plugin, which  is bundled and enabled in IntelliJ IDEA   by default. If the relevant features are not available, make sure that you did not disable the plugin.

> **Note:**
> Database Tools and SQL functionality support is limited in IntelliJ IDEA without the Ultimate subscription.

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Plugins`.

2. Open the Installed tab, find the Database Tools and SQL plugin, and select the checkbox next to the plugin name.

Procedure: Edit the DDL definition of a database object

1. In the   Database   tool window ,  click a database object.

2. Click the Source Editor button (![the Source Editor button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.actions.editSource_dark.svg)) on the toolbar. Alternatively, press `Ctrl+B` (Windows), `⌘ B` (macOS), `⌘ B` (IntelliJ IDEA Classic (macOS)), `⌘ B` (macOS System Shortcuts), `Ctrl+B` (XWin), `Ctrl+B` (GNOME), `Ctrl+B` (KDE), `Ctrl+Alt+G` (Emacs), `F12` (Sublime Text), `F12` (Sublime Text (macOS)), `Ctrl+B` (NetBeans), `F12` (Visual Studio), `F12` (Visual Studio (macOS)), `F3` (Eclipse), `F3` (Eclipse (macOS)).

![Edit the DDL definition of a database object](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_view_ddl_definition_of_db_object.png)

Procedure: Save generated DDL in SQL files

1. In the   Database   tool window ,  right-click a database object and select `SQL Scripts | SQL Generator`  `Ctrl+Alt+G` (Windows), `⌘ ⌥ G` (macOS), `⌘ ⌥ G` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ G` (macOS System Shortcuts), `Ctrl+Alt+G` (XWin), `Ctrl+Alt+G` (GNOME), `Ctrl+Alt+G` (KDE), `Ctrl+Alt+G` (Emacs), `Ctrl+Alt+G` (Sublime Text), `⌘ ⌥ G` (Sublime Text (macOS)), `Ctrl+Alt+G` (NetBeans), `Ctrl+Alt+G` (Visual Studio), `⌘ ⌥ G` (Visual Studio (macOS)), `Ctrl+Alt+G` (Eclipse), `⌘ ⌥ G` (Eclipse (macOS)).

2. In the SQL Generator tool window, click the File Output Options icon (![The File Output Options icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.save.svg)).

3. From the Layout list, select a method that you want to use:

* File per object: generates a set of SQL files.

* File per object with order: generates a numbered set of SQL files.

![Generate DDL for database objects](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_generate_sql_files_from_database_objects.png)

> **Tip:**
> SQL files are generated by a groovy script. To change the script, click the Settings icon (![The Settings icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.settings.svg)) and select Edit.

