Sobes.tech
Junior — Middle

How is the relationship between tables in a database ensured?

sobes.tech AI

Answer from AI

The relationship between tables in a database is maintained using keys:

  • Primary Key — a unique identifier for a record in a table.
  • Foreign Key — a field in one table that references the primary key of another table.

Thus, foreign keys create a link between tables, allowing data to be combined through JOIN operations. For example, an orders table may contain a foreign key pointing to a customer in the customers table.

How is the relationship between tables in a database… - sobes.tech