SELECT Clauses
Not Started

The SELECT keyword is used at the beginning of a SOQL query to define which fields you want to retrieve from an sObject. The basic syntax for a SELECT statement is:

SELECT AccountNumber FROM Account

This query retrieves the Account Number from every Account record in Salesforce. When writing a SELECT statement, notice that we're referencing the field's API Name, not the label.

When we want to retrieve more than one field, we separate them with a , comma. Let's also retrieve the Accounts' Name and Website:

SELECT Name, AccountNumber, Website FROM Account

NameAccountNumberWebsite
Edge CommunicationsCD451796http://edgecomm.com
Burlington Textiles Corp of AmericaCD656092www.burlington.com
Pyramid Construction Inc.CC213425www.pyramid.com



Similarly, we can retrieve the Name, Birthday, and Email fields from Contact:

SELECT Name, Email, Birthdate FROM Contact

NameEmailBirthdate
Rose Gonzalezrose@edge.com23616
Sean Forbessean@edge.com15852
Jack Rogersjrogers@burlington.com

Or Opportunity, with its custom OrderNumber__c field:

SELECT Name, StageName, ExpectedRevenue, OrderNumber__c FROM Opportunity

NameStageNameExpectedRevenueOrderNumber__c
Dickenson Mobile GeneratorsQualification1500
United Oil Office Portable GeneratorsNegotiation/Review112500
Express Logistics Standby GeneratorClosed Won220000653276



Challenge

Write a query that retrieves the Name, Email and Mailing Street from every Contact record in your org.