Both tables are linked by a foreign key relationship. The department ID, which is the primary key in the “departments” table, has been integrated into the “employees” table as a foreign key.
The link allows us to use an INNER JOIN over both tables. This is necessary, for example, to determine which employee works at which location.
When querying relational databases, a match of primary and foreign keys is usually defined as a selection condition. The condition is considered fulfilled if the selected foreign key of one table matches the primary key of the other table (=). This means that only those data records that contain common values are output.
An INNER JOIN like this is noted in relational algebra as follows:
employee⋈d_id=d_iddepartments
However, relational database systems do not accept commands in relational algebra syntax, but in the form of SQL statements.