Basic Concepts

Learn a few basic concepts of database relationships in Spring.

Primary key

A primary key is used to uniquely identify a row in a table. The id column in the player table shown below acts as a unique identifier for all records. No two records can have the same primary key value.

Press + to interact
Representing unique key identifiers
Representing unique key identifiers

Foreign key

Primary key can be used to link two tables together. When a primary key of one table is used in another table, it is known as a foreign key. To link the player and player_profile tables, the id column from the player_profile table is placed in the player table. The column profile_id is called the foreign key column and is used to point to the record in the player_profile table that is linked to the record in the player table. ...

Access this course and 1400+ top-rated courses and projects.