Book Image

Getting Started with SOQL

By : Magulan D
Book Image

Getting Started with SOQL

By: Magulan D

Overview of this book

<p>This practical guide will tell you everything you need to know about SOQL statements. You will learn the optimum way to write complex SOQL statements with this easy-to-understand guide. Beginning with basic SOQL statements, you will progress quickly onto more advanced statements, such as how to filter multiselect picklist values to escape sequences.</p> <p>This book will teach you how to sort records with more than one field, sorting with more than one field–one in ascending order and another field in descending order—and sorting null records in the first or in the last. You will learn about all the features provided while you are writing SOQL statements. This book will make you a SOQL expert by teaching you how to write SOQL statements in an optimized and effective way.</p>
Table of Contents (14 chapters)
Getting Started with SOQL
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

SOQL plays a vital role in the development of Salesforce.com and administration tasks. As a developer or as an administrator in Salesforce.com, we write many SOQL statements to fetch and validate the data present in the objects. If we know all the features in SOQL, we can easily write optimized SOQL statements to filter the data and fetch the required data from the object.

The sample queries used in this book will help you to understand the SOQL features easily. In the first few chapters, the sample queries are intended for beginners and for developers or administrators who are new to Salesforce.com. In the rest of the chapters, the sample queries are intended for Salesforce.com experts. So, in the first part, simple queries are used, and in the next part, complex queries are used for an easier understanding of the SOQL features. Real-time examples are used as sample queries. These examples include querying data from a single object as well as querying data from multiple objects in a single query.

This book also addresses the standards and guidelines to be followed when writing SOQL statements. The standards and guidelines discussed in this book will help you to write SOQL statements without hitting any limitation set by Salesforce.com and to avoid unwanted data fetched through the queries.

The last chapter provides the installation procedures to be followed to install the software needed to execute SOQL statements. These software help us to get the real-time data from the objects for viewing. They also help you to execute the sample queries used in this book in each and every chapter simultaneously.

The most interesting part is the knowledge check at the end of each chapter. The knowledge check is a kind of assessment that grabs our attention and concentration and helps us to recollect the topics learnt in that chapter. It is also helpful for Salesforce.com certification preparation.

What this book covers

Chapter 1, Introduction to SOQL, shows what SOQL is and its purpose. While discussing its purpose, we will see where exactly we should use SOQL statements in Salesforce.com development and administration.

Chapter 2, Basic SOQL Statements, shows how to write basic SOQL statements in Salesforce.com. We will start with simple alias notation. We will try out many examples to differentiate objects using alias notation.

Chapter 3, Advanced SOQL Statements, shows how to query records from more than one object using relationship queries. The steps to get the relationship name among objects will also be provided.

Chapter 4, Functions in SOQL, shows all the functions that are available in SOQL. It discusses about the methods for translating the field values using toLabel(), which will be very useful when we want to translate the values and show them in a report.

Chapter 5, Limitations and Best Practices, shows the standards to be followed when writing SOQL statements. The best practice explained here allows us to retrieve the required records by filtering well. As a developer or as an administrator, we should follow these standards and best practices.

Chapter 6, Tools with Installation Guidelines, shows a few tools that are available to execute SOQL statements. The installation guidelines will also be discussed with step-by-step instructions.

What you need for this book

A basic knowledge in Salesforce.com CRM is a prerequisite to follow the examples in this book. A basic knowledge of SQL is an added advantage.

Who this book is for

This book is intended for Salesforce.com developers and administrators. Developers and administrators with a basic knowledge of Salesforce.com will find the material in this book accessible without additional preparation. Salesforce.com developers and administrators will find all the features that are available for writing SOQL statements.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows:

"Filtering a multiselect picklist field using the INCLUDES and EXCLUDES operators will be discussed in detail."

Any command-line input or output is written as follows:

SELECT Id, Name FROM Account

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "The Objects link displays all the custom objects available in our organization."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.