PhpStorm 2019.1 Help

Сolumns

Add a column

  1. Right-click a table and select New | Column.

  2. Specify a column name and settings.

  3. Click Execute.

Delete a column

  1. Right-click a column and select New | Drop. Alternatively, press N/A.

  2. (Optional) Click the Settings icon (The Settings icon ) to configure the drop process.

  3. Click OK.

Drop a column

Modify a column

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

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

Reorder columns

To reorder columns, use drag-and-drop for the corresponding cells in the header row.

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 Column List (Ctrl+F12). In the Column List window, select a column name and press Space. You can hide all columns. To search through the column list, just start typing a column name in the Column List window.

Hide a column

Show columns

  1. Right-click any of the cells in the header row and select Column List. Alternatively, press Ctrl+F12.

  2. Select the hidden column (a strikethrough column name) and press Space.

Show a column

Sort data

To sort table data in a column, click the cell in the header row.

State

Description

No sorting

Indicates that the data is not sorted in this column. The initial state of the sorting marker.

Ascending order

The data is sorted in the ascending order. The number to the right of the marker (1 on the picture) is the sorting level. You can sort by more than one column. In such cases, different columns will have different sorting levels.

Descending order

The data is sorted in the descending order.

Inject a language for a column

You can assign a formal language (such as HTML, CSS, XML, RegExp, etc.) 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 features IDE features.

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

Inject a language for a column

Create an index

A database index is a structure that is used to speed up locating and accessing operations in a database table. By using indexes, you decrease the number of disk accesses that are required when a query is processed. You can create indexes for one or more columns of a database table.

  1. In the Database tool window (View | Tool Windows | Database), expand the data source tree until the node of a column.

  2. Right-click a table or a column and select New | Index.

  3. In the Columns pane, click the Add button (the Add button).

  4. In the Name field, specify the name of the column that you want to add to the index.

  5. Click Execute.

Create an index

Create a foreign key

A foreign key is a column or a set of columns in one table that uniquely identifies rows in another column. The table that contains a foreign key is a child table, the table that contains a candidate key is a referenced or target table.

  1. In the Database tool window (View | Tool Windows | Database), expand the data source tree until the node of a child table.

  2. Right-click a child table and select New | Foreign Key.

  3. In the Target table pane, specify the name of the target table.

  4. In the Columns pane, click the Add button (the Add button).

  5. In the From field, specify the name of the column in the child table.

  6. In the To field, specify the name of the column in the target table.

  7. Click Execute.

Create a foreign key

Modify templates for generated index and key names

When you create indexes, and primary and foreign key constraints, their default names are generated according to corresponding templates. For a primary key, for example, the template is {table}_{columns}_pk.

To view and modify these templates, open the settings Ctrl+Alt+S and navigate to Editor | Code Style | SQL | Common SQL. Click the Code Generation tab.

The templates can contain variables and text. When you generate a name, the specified text is reproduced literally. For example, when you apply the {table}_pk template in the actor table, the generated name of the primary key will be actor_pk.

To see information about possible variables and their usage, place the cursor into a field and press Ctrl+Q.

{unique?u:} checks if the index is unique and inserts the corresponding sequence of characters. If the index is unique, the template generates a name with the sequence of characters specified between ? and :. For the {unique?u:} template, it is u. If the index is not unique, the sequence between : and } is inserted. For the {unique?u:} template, it is nothing.

Example

You have the persons table with columns FirstName and LastName. The {table}_{columns}_{unique?u:}index template generates the following name for the not unique index: persons_FirstName_LastName_index.

Modify templates          for generated index and key names
Last modified: 8 July 2019