How to Relationship Query in Salesforce?

0
656

Table of Contents

Recap

In the previous blog post, we talked about what is SOQL and how we can perform the basic SOQL in Salesforce using the Developer Console.

Introduction

Here in this blog post, we will talk about how we can work on the relation ship queries in Salesforce.

Relationship queries are very important as we will be using these SOQLs in our day to day development duties.

SOQL Continue

  • HAVING
    • Having Count(Id) > 1
  • Relationship queries: child-to-parent
    • Contact ( Child )
      • Account
    • Opportunity ( Child )
      • Account
    • Case ( Child )
      • Account
      • Contact
  • Relationship queries: parent-to-child
    • Account (Parent)
      • Contact
      • Opportunity
      • Case

Watch Complete Video

Assignments

  • List All the Contact Records with Account Name, Rating, and Industry
  • Query on the Account object and also query all the related Contact, Case, Order, and Opportunities
  • Create 3 Custom Objects
    • An invoice that is related to the Account
    • An Invoice Line Item object that is related to the Invoice
    • A payment that is related to the Account
    • Now Query on Invoice Records to Query the Related Account Information and Also all the related Invoice Line Items
    • Note: – Please create the required records for these objects
  • Query All the Contact Record that does not have any Account Related To
  • Query All the Contact Records that are related to Account Record
  • Query All the Account Record that does not have any contact
  • Query All the Account Record that does have min one Contact Record
  • Query the Invoice Record, its Related Account, and Account Related Parent Account Record
  • Query the Invoice Line Item Record, its Related Invoice, Invoice Related Account, and Account Related Parent Account Record
  • Write a SOQL Query to Show the MAX amount from the opportunity
  • Write a SOQL Query to identify the duplicate records by Name & Email
  • Write a SOQL Query to display the count of Accounts for every Industry

Resources

LEAVE A REPLY

Please enter your comment!
Please enter your name here