PhpStorm 2020.2 Help

Primary keys

The primary key contains unique values and identifies each row in a table. The primary key cannot contain NULL values. A table can have only one primary key and this primary key can consist of single or multiple columns. When a primary key consists of multiple columns, the data from these columns is used to determine whether a row is unique.

Create a primary key

  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 Modify Table.

  3. On the Columns tab, click the Add button (the Add button) and type the column name.

  4. Select the column settings:

    • Not null: add the NOT NULL constraint that enforces a column to not accept NULL values.

    • Auto inc: automatically generate a unique number when a new record is inserted into a table.

    • Unique: ensure that all values in a column are different.

    • Primary key: identify a column as a primary key.

  5. Click Execute.

    Create a primary key
Last modified: 21 May 2020