# Columns

A column is a piece of data that is stored by a table. This data belongs to a particular type. A column may include text, numbers, or pointers to files in the operating system. Some relational database systems allow columns to include more complex data types like whole documents, images, or video clips.

Columns (    ![Column](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.column.svg)         ) can be found in the   Database   tool window   .

* For the reference on other node and object icons, refer to the [Data sources and their elements](database-tool-window.html#icons-for-data-sources-and-their-elements) chapter of [Database tool window](database-tool-window.html) topic.

* For the table column icons, refer to the [Possible icon combinations for columns](database-tool-window.html#possible-icon-combinations-for-columns) chapter.

* Hide, sort, filter, and group tree objects using the tree objects view options in the [View Options](database-tool-window.html#view_options) menu.

![Columns in Database](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database_object_column.png)

Procedure: Add a column

1. In the   Database   tool window ,    expand the data source tree until the nodes of    tables .

2. Right-click the        table  node and select `New |     Column` .

3. In the Modify  dialog that opens, enter the name of your column in the Name field.

4. In the Preview pane, you can view and change the generated SQL code.

5. Click OK to  add your column    .

![Add a column](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_add_new_column.png)

Procedure: Delete a column

1. Right-click a column and select `Object Actions | Drop…`. Alternatively, press `Delete` (Windows), `⌦` (macOS), `⌦` (IntelliJ IDEA Classic (macOS)), `⌦` (macOS System Shortcuts), `Delete` (XWin), `Delete` (GNOME), `Delete` (KDE), `Delete` (Emacs), `Delete` (Sublime Text), `⌦` (Sublime Text (macOS)), `Delete` (NetBeans), `Delete` (Visual Studio), `⌦` (Visual Studio (macOS)), `Delete` (Eclipse), `⌦` (Eclipse (macOS)).

2. Click OK to    save your changes and close the dialog  .

For more information about the dialog options, refer to [Confirm Drop dialog](confirm-drop-dialog.html).

![Drop a column](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_delete_column.png)

> **Note:**
> SQLite supports a limited subset of `ALTER TABLE` commands. In SQLite, you can rename a table, rename a column within a table, and add a new column to an existing table.  For more information about the command in SQLite, refer to  [the official SQLite documentation](https://www.sqlite.org/lang_altertable.html).
>
>
>
> To delete a column in SQLite, right-click a table and select Modify Table. In the Modify dialog, select the column that you want to delete and click the Remove button (![the Remove button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.remove.svg)). The Modify action recreates a table without the deleted column.

Procedure: Modify a column

Starting with IntelliJ IDEA 2022.1, you can change database-specific parameters of a column. The IDE generates fields for the Modify dialog automatically according to the properties received during the introspection. For example, by using this dialog in PostgreSQL, you can add and edit column check constraints.

1. In the   Database   tool window ,  right-click a column and select Modify Column.

2. In the Modify dialog, specify object settings that you need.

> **Note:**
> Column settings depend on the database vendor. For example, the Auto Increment checkbox is only available for SQLite, MySQL, and other vendors that allow it for a primary key column of an integer data type.

3. Click OK to   save your changes   .

Procedure: Reorder columns

* To reorder columns, drag the corresponding cells in the header row.

[Video](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_reorder_columns_by_dragging.mp4)

Procedure: Hide columns

* To hide a column, right-click the corresponding header cell and select Hide column.

Alternatively, you can right-click any of the cells in the header row and select Show Column List `Ctrl+F12` (Windows), `⌘ F12` (macOS), `⌘ F12` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ 7` (macOS System Shortcuts), `Ctrl+F12` (XWin), `Ctrl+F12` (GNOME), `Ctrl+0` (KDE), `Ctrl+F12` (Emacs), `Ctrl+R` (Sublime Text), `⌘ R` (Sublime Text (macOS)), `Ctrl+F12` (NetBeans), `Alt+\` (Visual Studio), `⌥ \` (Visual Studio (macOS)), `Ctrl+F3` (Eclipse), `⌘ O` (Eclipse (macOS)). In the column list popup window, select a column name and press `Space` (Windows), `Space` (macOS), `Space` (IntelliJ IDEA Classic (macOS)), `Space` (macOS System Shortcuts), `Space` (XWin), `Space` (GNOME), `Space` (KDE), `Space` (Emacs), `Space` (Sublime Text), `Space` (Sublime Text (macOS)), `Space` (NetBeans), `Space` (Visual Studio), `Space` (Visual Studio (macOS)), `Space` (Eclipse), `Space` (Eclipse (macOS)). You can hide all columns. To search through the column list, start typing a column name in the Show Column List window.

![Hide column](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_hide_columns.png)

Procedure: Show columns

1. Right-click any of the cells in the header row and select Show Column List. Alternatively, press `Ctrl+F12` (Windows), `⌘ F12` (macOS), `⌘ F12` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ 7` (macOS System Shortcuts), `Ctrl+F12` (XWin), `Ctrl+F12` (GNOME), `Ctrl+0` (KDE), `Ctrl+F12` (Emacs), `Ctrl+R` (Sublime Text), `⌘ R` (Sublime Text (macOS)), `Ctrl+F12` (NetBeans), `Alt+\` (Visual Studio), `⌥ \` (Visual Studio (macOS)), `Ctrl+F3` (Eclipse), `⌘ O` (Eclipse (macOS)).

2. Select the hidden column (a strikethrough column name) and press `Space` (Windows), `Space` (macOS), `Space` (IntelliJ IDEA Classic (macOS)), `Space` (macOS System Shortcuts), `Space` (XWin), `Space` (GNOME), `Space` (KDE), `Space` (Emacs), `Space` (Sublime Text), `Space` (Sublime Text (macOS)), `Space` (NetBeans), `Space` (Visual Studio), `Space` (Visual Studio (macOS)), `Space` (Eclipse), `Space` (Eclipse (macOS)).

![Show a column](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_show_columns.png)

> **Tip:**
> You can review the whole table structure in the Structure  tool window (`View | Tool Windows | Structure`). The Structure  tool window displays all columns.

Procedure: Reset the table view to the initial state

* Click the settings icon (![the settings icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app.expui.general.settings.svg)) and select Reset View. As a result, the data becomes unsorted, the columns appear in the order they were defined initially, and all the columns are shown.

![Restore the initial table view](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_reset_table_view.png)

Procedure: Inject a language for a column

* You can assign HTML, CSS, XML, RegExp, or any other formal language for the whole column. So, when you have a piece of code inside the cell that belongs to the column, you can use code generation, code completion, and other IDE features.

To inject a language for the whole column, right-click the corresponding header cell, and select Set Highlighting Language. In the list of supported languages, select the language that you want to inject.

![Inject a language for a column](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_inject_language_column.png)

Procedure: Change the column width

* Place the caret between two columns, so it changes to the resize mode. Drag it to the preferred position.

## Work with data

To learn how to work with column data, refer to the topics of [Data editor and viewer](data-editor-and-viewer.html) section:

1.

[Sort data](tables-sort.html)

You can sort data by clicking a column's header, or by entering a sorting query into the corresponding field. By default, each time you sort data, IntelliJ IDEA sends a new `ORDER BY` query to the database. You can also change the setting and sort data on the client side.

[Video](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_stacked_sorting.mp4)

2.

[Filter data](tables-filter.html)

Use one of the following ways to filter data:

* Specify filtering conditions.

* Run a search on the table.

* Enter a filtering query into the corresponding field.

![WHERE and ORDER BY fields for sorting](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_where_and_order_by_fields_for_sorting.png)

## Productivity tips

Procedure: Drag column names to your code

* In the   Database   tool window ,  select any database objects and drag them to your code.

![Drag column names to your code](https://resources.jetbrains.com.cn/help/img/idea/2026.2/drag_database_objects_to_code.png)

### Reference

[Create and Modify dialog](create-and-modify-dialogs.html#objects_editor)    [Possible icon combinations for columns](database-tool-window.html#possible-icon-combinations-for-columns)

### Related

[Primary keys](primary-keys.html)    [View data](tables-view-data.html)

### Tool Windows

[Database tool window](database-tool-window.html)

### Navigation

### Language and Framework-Specific Guidelines

[Database Tools and SQL](relational-databases.html)

