Search⌘ K
AI Features

Table Relationships

Explore the core concepts of table relationships in T-SQL, including how to define foreign keys and establish one-to-one, one-to-many, and many-to-many relationships between tables. Understand how to use these relationships to design relational databases that enforce data integrity and support complex queries.

A relationship is when one column of one table references another column in a different table. For example, we can have a table called Orders that contains a column ItemId that references the Id column of the Items table.

A table that references another table is called a child table. The table that is being referenced is called a parent table. In our example above, Items is the parent table referenced by the Orders table.

Foreign keys

To create a relationship, we use the concept of ...