---
schema_version: "1"
id: 54e3af23a70b9465c91fc7b799ea34e0a10b59e90f16465d8580adc1221d0bb2
title: Understanding Relationship Names
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/salesforce-soql-sosl/guides/soql-sosl/sforce-api-calls-soql-relationships-understanding.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-soql-sosl/guide/sforce-api-calls-soql-relationships-understanding.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: c0c17121b9f5d93e1f15d92bd214969181ec9823c439eb2816cf835fc9e274dc
products:
  - SOQL and SOSL Reference
  - Platform Developer Content
---

# Understanding Relationship Names

Parent-to-child and child-to-parent relationships exist between many types of objects. For example, Account is a parent of Contact.

![If Account is the parent and Contact is the child, the parent-to-child relationship name is Contacts and the child-to-parent relationship name is Account.](https://developer.salesforce.com/media/salesforce-soql-sosl/rel_basic.png)

To be able to traverse these relationships for standard objects, a relationship name is given to each relationship. The form of the name is different, depending on the direction of the relationship:

- For child-to-parent relationships, the relationship name to the parent is the name of the foreign key, and there is a `relationshipName` property that holds the reference to the parent object. For example, the Contact child object has a child-to-parent relationship to the Account object, so the value of `relationshipName` in Contact is `Account`. These relationships are traversed by specifying the parent using dot notation in the query, for example:

  <!-- otherprops: soql -->

  ```codesegment
  SELECT Contact.FirstName, Contact.Account.Name from Contact
  ```

  This query returns the first names of all the contacts in the organization, and for each contact, the account name associated with (parent of) that contact.

- For parent-to-child relationships, the parent object has a name for the child relationship that is unique to the parent, the plural of the child object name. For example, Account has child relationships to Assets, Cases, and Contacts among other objects, and has a `relationshipName` for each, `Assets`, `Cases`, and `Contacts`.These relationships can be traversed only in the `SELECT` clause, using a nested SOQL query. For example:

  <!-- otherprops: soql -->

  ```codesegment
  SELECT Account.Name, (SELECT Contact.FirstName, Contact.LastName FROM Account.Contacts) FROM Account
  ```

  This query returns all accounts, and for each account, the first and last name of each contact associated with (the child of) that account.

**note:** You must use the correct naming convention and `SELECT` syntax for the direction of the relationship. For information about how to discover relationship names via your organization's WSDL or describeSObjects(), see [Identifying Parent and Child Relationships](https://developer.salesforce.com/docs/platform/salesforce-soql-sosl/guide/sforce-api-calls-soql-relationships-parent-child.md#identifying-parent-and-child-relationships). There are limitations on relationship queries depending on the direction of the relationship. See [Understanding Relationship Query Limitations](https://developer.salesforce.com/docs/platform/salesforce-soql-sosl/guide/sforce-api-calls-soql-relationships-query-limits.md#understanding-relationship-query-limitations) for more information.

Relationship names are different for custom objects, though the `SELECT` syntax is the same. See [Identifying Parent and Child Relationships](https://developer.salesforce.com/docs/platform/salesforce-soql-sosl/guide/sforce-api-calls-soql-relationships-parent-child.md#identifying-parent-and-child-relationships) for more information.
