Using the Salesforce Object Query Language (SOQL) to Query Data in Data Cloud
Similar to how you use SOQL to query Salesforce objects, you can also use SOQL to query Data Cloud objects, such as DLOs and DMOs, with some limitations. SOQL is Salesforce's proprietary query language to query Salesforce objects. You can run SOQL in Apex or by using tools such as the Query Editor and SOQL Builder.
To learn about querying DMOs in Apex with SOQL, see Data Cloud in Apex in the Apex Developer Guide. Also see Mock SOQL Tests for Data Cloud Data Model Objects in the Apex Developer Guide.
SOQL is similar to SQL, but here are a few differences between the two.
- SOQL statements can execute in Apex on the Salesforce Platform, and not only using an API.
- SOQL doesn’t support the asterisk (
*
) character to retrieve all fields in theSELECT
statement. To retrieve all fields, use theFIELDS(ALL)
keyword or retrieve specific fields. - SOQL provides parent and child relationships instead of
JOIN
statements. These relationships aren't supported in the current implementation of SOQL in Data Cloud.
For the SOQL language reference, see Salesforce Object Query Language (SOQL). To learn about the use of SOQL in general with Salesforce objects, see the SOQL for Admins Trailhead module.
See Also