SELECT * FROM activity JOIN visitor ON visitor_id = visitor.id Alternatively to foreign keys, virtual foreign keys are not defined in the database code. In this case, you can still create foreign key relations without changing your database code. Reasons for not using foreign keys might include performance issues (in CRUD operations), database characteristics (databases like ClickHouse and Apache Cassandra do not support foreign keys), usage of temporary tables (for testing), personal reasons, and other. There are cases when you do not want to use explicitly-defined foreign keys. In the To field, specify the name of the column in the target table. In the From field, specify the name of the column in the child table. In the Columns pane, click the Add button. In the Target table pane, specify the name of the target table. Right-click a child table and select New | Foreign Key.
#Phpstorm keys windows#
In the Database tool window ( View | Tool Windows | Database), expand the data source tree until the node of a child table. In the following example, activity.activity_id is a primary key, while visitor.activity_id is a foreign key.
If your database contains explicit foreign key relationships, PhpStorm automatically uses them in auto-completion, data navigation, and diagrams. The table that contains a candidate key is a referenced or target table. The table that contains a foreign key is a child table. FOREIGN KEY (activity_id) REFERENCES activity(activity_id)