# Master-Detail Tables (Parent-Child Linked Records)

## Master-Detail Tables (Parent-Child Linked Records)

Master-detail tables are used to represent a one-to-many relationship between two entities. In this relationship, the data in one table (the **master** table) is related to multiple records in another table (the **detail** table).

Also known as **parent-child linked records**, this feature establishes a hierarchical relationship between two sets of records by connecting one record (the parent) to one or more related records (the children). This structure enables logical data grouping and is used to represent a master record along with its associated details. For example, there could be a list of *customers* (parent records), each with several *orders* (child records).

**Why Use Master-Detail Tables?**

* **Organized Data Structure:** Group related records (such as orders and line items) for easier access and comprehension. This is especially useful when you are working with complex datasets.
* **Ensure Data Integrity:** Link all child records to their parent records to prevent inconsistent data entries that lack context. (e.g., an order item with no associated customer)
* **Streamlined Data Entry and Update:** Child records inherit values from their parents, making data updates easier and reducing duplication. For instance, you can add a common field to the master table instead of updating all child records.
* **Simplified Reporting & Filtering:** You can drill down and filter reports easily based on parent-level criteria.
* **Improved User Experience:** Master-detail view enables you to easily manage related data on a single screen.

**Here's a breakdown of the key components:**

**Master Table:** The master table contains unique records and serves as the main source of information. Each record in the master table represents a single entity or object. For example, in a product store database, the master table could be the 'categories' table, with each record representing a different product category.

**Detail Table:** The detail table has related records that connect to one record in the master table. This establishes a link between the master table and its associated data. For example, the detail table could be the 'products' table, where each record represents a product belonging to one of the categories in the 'categories' table, as shown below.

**Foreign Key Column:** The relationship between the master and the detail table is established through a common column known as the **foreign key**. The foreign key in one table (the detail table) references the primary key of another table (the master table).

In our example, each record in the *products* table refers to its associated parent record in the *categories* table using the foreign key **CategoryID**.

The master table and detail table typically have a one-to-many relationship. This means that a single record in the master table can be linked to multiple records in the detail table, whereas each record in the detail table can only link to one record in the master table.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fabricplan.com/powertable-sheets/concepts/master-detail-tables-parent-child-linked-records.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
