> For the complete documentation index, see [llms.txt](https://presight.gitbook.io/presight-v1.0/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://presight.gitbook.io/presight-v1.0/model/data-relationships.md).

# Data Relationships

## Why Tables Have Relationships

In real-world scenarios, data is rarely confined to a single table. Information is often distributed across multiple tables that are logically connected. This is where **relationships between tables** come into play. Table relationships define how data in one table corresponds to data in another table, enabling more complex and meaningful queries and analyses.

## Types of Table Relationships

* **Has one (One-to-One Relationship)**: Each row in one table corresponds to exactly one row in another table.
* **Has many (One-to-Many Relationship)**: A single row in one table can relate to multiple rows in another table. For example, a **Customer Table** (one side) can relate to multiple rows in an **Orders Table** (many side), representing the orders placed by each customer.
* **Belongs to (Many-to-One Relationship)**: Many rows from one table are related to a single row in another table. For instance, multiple orders in the **Orders Table** can relate back to a single entry in the **Customer Table**.

***

## Getting Started with Data Relationships on Presight

### Locate your Data

All tables connected with Presight are located at <mark style="color:blue;">**Data Hub**</mark>, tab <mark style="color:blue;">**Data**</mark>:

<figure><img src="https://133649292-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIYMCWeQmo9kVg5C6SOyv%2Fuploads%2FYc6I6cbpwF1tShdb3niU%2Fimage.png?alt=media&amp;token=f6a4042c-b130-4964-908b-62d58a8983a2" alt=""><figcaption></figcaption></figure>

Tab Data will show all the data sources based on your workspace configurations:

* PostgreSQL: you database name connected to Presight via [API Connector](/presight-v1.0/data-in/connect/data-connectors/api-connector.md), this can be PostgreSQL, Amazon Redshift, Google BigQuery or any other cloud providers you are using. This will list all the tables coming from the database.
* Query: your [Custom Queries](/presight-v1.0/model/custom-tables/custom-sql-query.md)
* Google Sheet: your [Google Sheets Connection](/presight-v1.0/data-in/connect/data-connectors/google-sheets-connection.md)
* Custom: all tables created on Presight via [Table Builder](/presight-v1.0/model/custom-tables/table-builder.md)

### Raw Table view

You can view your raw tables/cubes from by clicking on <mark style="color:blue;">**View**</mark> at the Table's row.&#x20;

<figure><img src="https://133649292-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIYMCWeQmo9kVg5C6SOyv%2Fuploads%2F8dFYGpXenuuwfYsPhH2M%2Fimage.png?alt=media&amp;token=e34ba61f-607b-4509-b6ea-0a37202d672e" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
You can change column permission, filter specific values and change data type at each column at the raw table:

![](https://133649292-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIYMCWeQmo9kVg5C6SOyv%2Fuploads%2FKD9bbm1qYQ8eCJmtnEy8%2Fimage.png?alt=media\&token=61e759a9-5de6-4ff4-a318-1c350378ba3f)
{% endhint %}

If you are the admin of your workspace, you can edit Table Restriction and Column Restriction for each table. Details for Access Restriction are in the following link:

{% content-ref url="/pages/HlnpwqvDOOG5z1JWJddj" %}
[Table Restriction](/presight-v1.0/governance/table-restriction.md)
{% endcontent-ref %}

## Data Relationship

You can view Relationship between tables by dragging them to the <mark style="color:blue;">**Diagram Board**</mark>:

<figure><img src="https://133649292-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIYMCWeQmo9kVg5C6SOyv%2Fuploads%2FBHreZJjrDhEMHQxBOLxl%2Frelation2.gif?alt=media&amp;token=6adf2a03-f68b-4249-a952-785103931e8f" alt=""><figcaption></figcaption></figure>

You can also make or edit Relationships here.

{% hint style="info" %}
Instructions for making and editing Relationships in the documentations below:
{% endhint %}

{% content-ref url="/pages/m9cr4wdejP90b9Q7mMVy" %}
[Table Relationships](/presight-v1.0/model/data-relationships/table-relationships.md)
{% endcontent-ref %}
