Today's Offer - Salesforce Certification Training - Enroll at Flat 10% Off.

- Salesforce Blogs -

What does Salesforce use as a database? Salesforce Databases Guide

Salesforce is the leading cloud vendor today due to an amazing range of services and offerings that has gained immense popularity during the last few years. In this post, we will majorly focus on the database concepts in We will check how Salesforce is connected to multiple relational database systems available in the technical marketplace.

All databases could be similar to the objective but they are different in terms of naming and conventions. Here, we will see how can we create the data sources and how to establish or maintain a relationship among multiple data objects.

What is a database in Salesforce?

A Database in Salesforce is defined as the organized collection of objects where each object contains some information. Data is stored in the form of database tables for people, things, contacts etc that are important for any project in the future. Each database has a set of certain rows and columns where information is stored in the form of fields and records. salesforce Curriculum Take an example of Employee table where information is stored in the form of different fields like employee ID, salary, designation, name, contact details, etc. Here, Employee is an object and all related information is taken as fields. Types of Objects in Salesforce

Three most common types of objects as defined in the Salesforce include –

  • Standard Objects – These types of objects are readily available and pre-defined in the Salesforce.
  • Custom Objects – These types of objects are created on special demands only as needed by the user. For each custom object, there are five standard fields that are necessary to understand when you are defining any custom objects. These are –
    • ID – this is a unique index allocate to each objection at the time of creation. It generally consists of 15 to 18 digit that is highly case sensitive like a password.
    • Name
    • Owner
    • Created Date / Created By
    • Last modified time / Last modified by
  • External Objects – These are custom objects only that are used to map the data outside the organization or external to your firm.

Apart from these three objects, there are a few objects that are available in API as well and we could access authorized objects only. The access to an object can be defined in multiple ways like user permissions, user ID, object configuration, access settings, data model, or any other factor that could be related to an object. Most of the objects from API have read-write access and a few of them are assigned read-only permissions.

How are Database Relations defined in the Salesforce?

Relationships in Salesforce are used to connect different objects together. There are multiple relationships that could be defined for the Salesforce on the child object. The child object could have complete access to the object defined in the parent section based on the relationship and permissions defined. 

Database Relations defined in the Salesforce

1). Many to one (n:1)

In this type of relationship, there is only one parent object and multiple child objects. For example, there are a number of metro cities in a country. It is further divided into four major categories as shown above in the hierarchy diagram –

  • Master-detail
  • Look Up (Loosely Coupled Relationship)
  • Self
  • Hierarchical

Let us discuss each of them one by one in detail below –

Read: A Complete Guide for Salesforce Metadata API

Master-Detail relationships

Here, we have one parent object and multiple child objects. For this type of relationship, you need to keep the following facts in mind –

  • The child record will be deleted automatically, once the master record is deleted.
  • Every time you wanted to create a child object then the reference of the parent object is needed.
  • There are no separate permissions or security settings defined for the child object but they are automatically inherited by the parent object.
  • The owner settings are automatically assigned to associated master objects.
  • On the page layout, there is a master-detail relationship is defined for the object.
  • The administrator will decide either child objects should be represented within the parent object or not.

This is possible to define the master-detail relationships on two or more custom objects. The relationship can be defined among one standard and one custom object but the custom object could not be fixed at the detail side. And the data for custom objects is displayed on the page layout. Keep in mind that master-detail relationships are not applicable to the object where User or Lead objects are defined as the master.

Look up Relationship:

This is one more category of one-to-many relationship but two objects will not put any effect on deletion or security. In this case,

  • Child objects are also independent. If we are deleting the parent object then child object will not get deleted.
  • The separate settings could be defined for the child object.
  • If we will delete the parent object then the child object would still remain into the system.
  • In this case, the child object may or may not have a parent.


In this type of relationship, the object is self-referred. For example, add-on card onto your credit card.

Hierarchical Relationship:

Read: Salesforce Platform Developer 1 Exam – Certification Guide & Tips

It is very much similar to the lookup relationship but it can be defined for user objects only. Further, you can use lookup fields to connect multiple users together. User objects may refer to themselves either directly or indirectly.

2). Many to Many Relationship

This type of relationship is used to model many-to-many relationships between any two objects. For many-to-many relationships, each record of one object could be further linked to multiple records from other objects and vice versa. In this case, we should create the junction object to help in creating many-to-many relationship fields and they are further connected to custom objects.

What is a Junction Object?

This object is needed to create many-to-many relationships that support two type of relationships master-detail and the lookup relationships. They both are one-to-many relationships and to define many-to-many relationships in that case, we need a Junction Object.

How are many-to-many and one-to-many relationships different?

A one-to-many relationship is always defined on master-detail or look up relationships while many-to-many relationships are defined using two master objects. For many-to-many relationships, each record of one object could be further linked to multiple records from other objects and vice versa. salesforce quiz Look up is one-to-many type relationship where two objects are connected but the child object will not get impacted once parent object is deleted. At the same time, in the case of a normal one-to-many relationship, when a master record is deleted, the child will also be deleted automatically.

Normal Database (Excel) vs. Relational Database (

In case of normal databases, there is duplicate information can be used several times. But in the case of relational databases, there is always unique information is stored one instance can be used to refer multiple fields together. Generating a report in Excel is tedious and when it comes to Salesforce, reporting features are just overwhelming and enjoyed by developers.

Read: How To Create a Custom Object TABS In Salesforce.Com?

Primary key vs. Foreign Key in the Salesforce database (Conceptual Knowledge)

A Primary key is defined as the column or a set of columns that can identify each record in the table uniquely. When a primary key is defined with the help of multiple columns, data from each row is assessed to check the uniqueness. Every time a column is defined as the unique key, there are some constraints to follow like column value should not be NULL and the data would always be UNIQUE.

At the same time, a Foreign key is defined as the column or a set of columns that is referring to the primary key of another table. This is not necessary that foreign key will always follow the primary key but the basic idea behind foreign key is that any column that is unique to identify that record. When we are learning the Salesforce as a database, this is necessary to get the basic knowledge of SOQL too. free salesforce demo

What is SOQL? When to use SOQL?

SOQL is Salesforce Object Query Language that is highly similar to SQL (Structured Query Language). With the help of SOQL, you can always search the organizational data wisely. It can be combined with APEX, Visualforce, or IDE too. While writing a query using SOQL, you should use SELECT command and a lot of other conditions too. Here, is the basic syntax how to write SOQL query in Salesforce using SELECT command – When to use SOQL

Now let us learn when should you use SOQL. The SOQL can be used when you have the basic idea of objects and the related data. It can be used to retrieve data from one or multiple objects that are connected together based on requirements. It helps in getting the total count and sort queries as well. Further, it can be combined with SOSL (Salesforce Object Search Language) to search the organizational data when they are not sure on objects.

SOSL is programmed in such a way to work on the basis of the search index. To improve the performance of searching, you should combine SOQL and SOSL together because searching work is done better by SOSL as compared to the SOQL.

That’s all for the day. You have learned a lot about the Salesforce database and related concepts too. To know more, you should join the Salesforce certification training program to get the hands-on expertize on database concepts.

Read: Is it worth to learn Salesforce? Top 10 Reasons to Learn Salesforce?

    Janbask Training

    A dynamic, highly professional, and a global online training course provider committed to propelling the next generation of technology learners with a whole new way of training experience.

Trending Courses


  • AWS & Fundamentals of Linux
  • Amazon Simple Storage Service
  • Elastic Compute Cloud
  • Databases Overview & Amazon Route 53

Upcoming Class

9 days 02 Feb 2020


  • Intro to DevOps
  • GIT and Maven
  • Jenkins & Ansible
  • Docker and Cloud Computing

Upcoming Class

3 days 27 Jan 2020

Data Science

  • Data Science Introduction
  • Hadoop and Spark Overview
  • Python & Intro to R Programming
  • Machine Learning

Upcoming Class

0 day 24 Jan 2020


  • Architecture, HDFS & MapReduce
  • Unix Shell & Apache Pig Installation
  • HIVE Installation & User-Defined Functions
  • SQOOP & Hbase Installation

Upcoming Class

1 day 25 Jan 2020


  • Salesforce Configuration Introduction
  • Security & Automation Process
  • Sales & Service Cloud
  • Apex Programming, SOQL & SOSL

Upcoming Class

4 days 28 Jan 2020


  • Introduction and Software Testing
  • Software Test Life Cycle
  • Automation Testing and API Testing
  • Selenium framework development using Testing

Upcoming Class

3 days 27 Jan 2020

Business Analyst

  • BA & Stakeholders Overview
  • BPMN, Requirement Elicitation
  • BA Tools & Design Documents
  • Enterprise Analysis, Agile & Scrum

Upcoming Class

3 days 27 Jan 2020

SQL Server

  • Introduction & Database Query
  • Programming, Indexes & System Functions
  • SSIS Package Development Procedures
  • SSRS Report Design

Upcoming Class

7 days 31 Jan 2020


Search Posts


Receive Latest Materials and Offers on Salesforce Course