SOQL learning using Real Life Scenario
Over the course, we will be sharing various examples related to SOQL features. Let’s see the real-life use case, on which these will be explained.
Kyle Medical Group(KMG) is a healthcare provider across the USA, mainly related to heart diseases. KMG has several clinics in various states of the USA. KMG uses Salesforce to manage all the appointments for the patients.
KMG simplified data model:
Fig: Data Model of KMG Appointment Management System
- The patients are represented in Contact standard object in Salesforce.
- The clinics are represented by Clinic__c custom object in Salesforce.
- An appointment is represented by Appointment__c custom object.
- It has two lookup relationships, one with contact and another with clinic.
- It’s a parent-child relationship.
- A contact can have multiple appointments.
- A clinic can have multiple appointments.
- The appointment is a junction object.
Important
Note that the custom objects and custom fields are denoted by appending "__c" after their name, whereas standard objects and standard fields (Account, Contact, Opportunity, ...) don't have these suffix.
These are referred to as API Names in Salesforce.
These are referred to as API Names in Salesforce.
Now, when we move towards specific examples explaining the features of SOQL, we shall refer to this model, for example.