Learn Salesforce SOQL in Simple Easy Steps
Salesforce Professionals, Admins, Consultants, End Users — If you think SOQL = For Developers, you may want to reconsider. Using SOQL (Salesforce Object Query Language), you can talk to the data stored in your Salesforce Org in easy yet powerful ways. How many records are there in the Account object, how many Contacts exist for an Account, what is the count of Opportunities by stages — and many questions can be answered in less than a minute using SOQL. If you don't know SOQL, you will be creating reports, getting the information, and deleting these reports.
I have been planning to write a blog post on how to get started with SOQL (especially if you are a non-developer), and then I came across this series of blogs by Kieren Jameson.
Kieren has done a fantastic job of explaining SOQL in a three-part series of blog posts.
The first blog post introduces the basics of SOQL and can be accessed at URL http://womencodeheroes.com/2015/04/cooking-with-code-a-sweet-intro-to-soql-part-one/
The second blog post explains how to link different objects together and pull data out and is available at URL http://womencodeheroes.com/2015/04/cooking-with-code-a-sweet-intro-to-soql-part-two/
And in the third post you will dive into advanced features of SOQL like aggregates, advanced operators and wildcards, working with dates and numbers, and more advanced WHERE conditions. Check it out at http://womencodeheroes.com/2015/04/cooking-with-code-a-sweet-intro-to-soql-part-three/
Following these articles and practising them on your Salesforce Org, you can add the power of SOQL to your Salesforce skill set in less than a day.
If you are worried about screwing things up in your Salesforce Org by using SOQL, relax. Using SOQL, you can only query the data and NOT insert, update, or delete anything. And then Salesforce Governor Limits will act like a Big Brother to you. If you do write a query that is not optimized or tries to pull hundreds of thousands of records, Big Brother will stop you.
In the first part of the blog post, Kieren has mentioned the tools (Developer Console & Workbench) that you can use to run SOQL.
Here are some more that you can use to play with SOQL (Note that except for the first option of Developer Console, you will need to have the 'API Enabled' system permission to use all other tools).
Developer Console - (Requires 'View All Data' or 'Author Apex' permission to access the tool)
Force.com IDE - (A little complicated to use if you are not a developer)
Force.com Explorer - (The tool hasn't been updated since 2011)
If you are not familiar with SQL at all, you may want to check out this tutorial from Khan Academy on what SQL is. This tutorial has nothing to do with Salesforce. It just explains the concept of SQL in a series of nice videos.