instruction stringlengths 34 110 | input stringclasses 1
value | output stringlengths 46 236 |
|---|---|---|
Query big object AssetRelationship__c for records after 2021-01-01 | SELECT Id, EventDate__c, OwnerId__c FROM AssetRelationship__c WHERE EventDate__c > 2021-01-01T00:00:00Z | |
Convert currency for opportunity Amount to corporate currency | SELECT Id, Name, Amount, convertCurrency(Amount) FROM Opportunity WHERE IsClosed = false | |
Convert currency for opportunity Amount to corporate currency | SELECT Id, Name, Amount, convertCurrency(Amount) FROM Opportunity WHERE IsClosed = false | |
TYPEOF example: for WhoId polymorphic, show Contact or Lead fields accordingly for Task | SELECT Id, Subject, TYPEOF Who WHEN Contact THEN LastName, Email WHEN Lead THEN Company, Email END FROM Task WHERE Subject LIKE '%follow%' | |
Get CommerceObject4 for view statistics in last 30 days | SELECT Id, Name FROM CommerceObject4 WHERE LastModifiedDate = LAST_N_DAYS:30 FOR VIEW | |
Get PlatformObject15 where Id is in (1846,7065,3685) | SELECT Id, Name FROM PlatformObject15 WHERE Id IN (1846,7065,3685) | |
Get EinsteinObject5 where IsActive is in (922,9232,4182) | SELECT Id, Name FROM EinsteinObject5 WHERE IsActive IN (922,9232,4182) | |
Find MarketingObject13 where OwnerId includes 'Cloud' | SELECT Id, Name FROM MarketingObject13 WHERE OwnerId INCLUDES ('Cloud') | |
Include soft-deleted rows for SecurityObject4 | SELECT Id, Name, IsDeleted FROM SecurityObject4 USING SCOPE ALL ROWS | |
Aggregate total revenue by Status using ROLLUP for Account | SELECT Status, SUM(AnnualRevenue) totalRevenue FROM Account GROUP BY ROLLUP(Status) | |
Query big object ExperienceObject18 for records after 2021-01-01 | SELECT Id, EventDate__c, OwnerId__c FROM ExperienceObject18 WHERE EventDate__c > 2021-01-01T00:00:00Z | |
TYPEOF example: for WhoId polymorphic, show Contact or Lead fields accordingly for Task | SELECT Id, Subject, TYPEOF Who WHEN Contact THEN LastName, Email WHEN Lead THEN Company, Email END FROM Task WHERE Subject LIKE '%follow%' | |
Include soft-deleted rows for MarketingObject8 | SELECT Id, Name, IsDeleted FROM MarketingObject8 USING SCOPE ALL ROWS | |
Get ExperienceObject3 where IsActive is in (4346,4150,4643) | SELECT Id, Name FROM ExperienceObject3 WHERE IsActive IN (4346,4150,4643) | |
Use GROUP BY with multiple fields to summarize revenue | SELECT Industry, Type, SUM(AnnualRevenue) total FROM Account GROUP BY Industry, Type | |
Use GROUP BY with multiple fields to summarize revenue | SELECT Industry, Type, SUM(AnnualRevenue) total FROM Account GROUP BY Industry, Type | |
Include soft-deleted rows for ExperienceObject8 | SELECT Id, Name, IsDeleted FROM ExperienceObject8 USING SCOPE ALL ROWS | |
Find Accounts that have Contacts with Cases that include 'escalate' in comments | SELECT Id, Name FROM Account WHERE Id IN (SELECT AccountId FROM Contact WHERE Id IN (SELECT ContactId FROM Case WHERE Id IN (SELECT ParentId FROM CaseComment WHERE CommentBody LIKE '%escalate%')) ) | |
Show COUNT of Quantity grouped by AccountId for MarketingObject5 | SELECT AccountId, COUNT(Quantity) val FROM MarketingObject5 GROUP BY AccountId | |
Show AVG of FieldServiceObject11Field2 grouped by OwnerId for FieldServiceObject11 | SELECT OwnerId, AVG(FieldServiceObject11Field2) val FROM FieldServiceObject11 GROUP BY OwnerId | |
Get MessagingUser where Amount is in (6375,2603,3605) | SELECT Id, Name FROM MessagingUser WHERE Amount IN (6375,2603,3605) | |
Find CommerceObject12 where EndDate contains 'Test' | SELECT Id, Name FROM CommerceObject12 WHERE EndDate LIKE '%Test%' | |
TYPEOF example: for WhoId polymorphic, show Contact or Lead fields accordingly for Task | SELECT Id, Subject, TYPEOF Who WHEN Contact THEN LastName, Email WHEN Lead THEN Company, Email END FROM Task WHERE Subject LIKE '%follow%' | |
Show me Document__c records created after 2022-05-15 | SELECT Id, Name FROM Document__c WHERE EndDate > '2022-05-15T00:00:00Z' | |
Use GROUP BY with multiple fields to summarize revenue | SELECT Industry, Type, SUM(AnnualRevenue) total FROM Account GROUP BY Industry, Type | |
Query big object Order for records after 2021-01-01 | SELECT Id, EventDate__c, OwnerId__c FROM Order WHERE EventDate__c > 2021-01-01T00:00:00Z | |
Use GROUP BY with multiple fields to summarize revenue | SELECT Industry, Type, SUM(AnnualRevenue) total FROM Account GROUP BY Industry, Type | |
Query big object CPQObject14 for records after 2021-01-01 | SELECT Id, EventDate__c, OwnerId__c FROM CPQObject14 WHERE EventDate__c > 2021-01-01T00:00:00Z | |
Get read-only reference snapshot of Opportunity before 2022 | SELECT Id, Name FROM Opportunity WHERE CreatedDate < 2022-01-01T00:00:00Z FOR REFERENCE | |
Show MAX of CPQObject19Field2 grouped by Type for CPQObject19 | SELECT Type, MAX(CPQObject19Field2) val FROM CPQObject19 GROUP BY Type | |
Use GROUP BY with multiple fields to summarize revenue | SELECT Industry, Type, SUM(AnnualRevenue) total FROM Account GROUP BY Industry, Type | |
Query big object CaseTeamMember for records after 2021-01-01 | SELECT Id, EventDate__c, OwnerId__c FROM CaseTeamMember WHERE EventDate__c > 2021-01-01T00:00:00Z | |
Get read-only reference snapshot of CaseTeamMember before 2022 | SELECT Id, Name FROM CaseTeamMember WHERE CreatedDate < 2022-01-01T00:00:00Z FOR REFERENCE | |
TYPEOF example: for WhoId polymorphic, show Contact or Lead fields accordingly for Task | SELECT Id, Subject, TYPEOF Who WHEN Contact THEN LastName, Email WHEN Lead THEN Company, Email END FROM Task WHERE Subject LIKE '%follow%' | |
Get read-only reference snapshot of User before 2022 | SELECT Id, Name FROM User WHERE CreatedDate < 2022-01-01T00:00:00Z FOR REFERENCE | |
Aggregate total revenue by Status using ROLLUP for Account | SELECT Status, SUM(AnnualRevenue) totalRevenue FROM Account GROUP BY ROLLUP(Status) | |
Convert currency for opportunity Amount to corporate currency | SELECT Id, Name, Amount, convertCurrency(Amount) FROM Opportunity WHERE IsClosed = false | |
Get MarketingObject19 where OwnerId is in (8851,541,6555) | SELECT Id, Name FROM MarketingObject19 WHERE OwnerId IN (8851,541,6555) | |
Query big object AnalyticsObject8 for records after 2021-01-01 | SELECT Id, EventDate__c, OwnerId__c FROM AnalyticsObject8 WHERE EventDate__c > 2021-01-01T00:00:00Z | |
Find Accounts that have Contacts with Cases that include 'escalate' in comments | SELECT Id, Name FROM Account WHERE Id IN (SELECT AccountId FROM Contact WHERE Id IN (SELECT ContactId FROM Case WHERE Id IN (SELECT ParentId FROM CaseComment WHERE CommentBody LIKE '%escalate%')) ) | |
Find PlatformObject9 where EndDate includes 'Demo' | SELECT Id, Name FROM PlatformObject9 WHERE EndDate INCLUDES ('Demo') | |
Get ServiceTerritory where TotalAmount is in (6311,5463,3567) | SELECT Id, Name FROM ServiceTerritory WHERE TotalAmount IN (6311,5463,3567) | |
Get read-only reference snapshot of FieldServiceObject7 before 2022 | SELECT Id, Name FROM FieldServiceObject7 WHERE CreatedDate < 2022-01-01T00:00:00Z FOR REFERENCE | |
Use GROUP BY with multiple fields to summarize revenue | SELECT Industry, Type, SUM(AnnualRevenue) total FROM Account GROUP BY Industry, Type | |
TYPEOF example: for WhoId polymorphic, show Contact or Lead fields accordingly for Task | SELECT Id, Subject, TYPEOF Who WHEN Contact THEN LastName, Email WHEN Lead THEN Company, Email END FROM Task WHERE Subject LIKE '%follow%' | |
Show AVG of CreatedDate grouped by Status for CommerceObject15 | SELECT Status, AVG(CreatedDate) val FROM CommerceObject15 GROUP BY Status | |
Find EinsteinObject16 where Name equals Sample5734 | SELECT Id, Name FROM EinsteinObject16 WHERE Name = 'Sample5734' | |
List PlatformObject12 ordered by CreatedDate desc limit 1 | SELECT Id, Name FROM PlatformObject12 ORDER BY CreatedDate DESC LIMIT 1 | |
Use GROUP BY with multiple fields to summarize revenue | SELECT Industry, Type, SUM(AnnualRevenue) total FROM Account GROUP BY Industry, Type | |
Find SalesObject6 where Type equals Sample334 | SELECT Id, Name FROM SalesObject6 WHERE Type = 'Sample334' | |
Query big object MessagingSubscription for records after 2021-01-01 | SELECT Id, EventDate__c, OwnerId__c FROM MessagingSubscription WHERE EventDate__c > 2021-01-01T00:00:00Z | |
List UserRole ordered by IsDeleted desc limit 1 | SELECT Id, Name FROM UserRole ORDER BY IsDeleted DESC LIMIT 1 | |
Query big object ProductRequest__c for records after 2021-01-01 | SELECT Id, EventDate__c, OwnerId__c FROM ProductRequest__c WHERE EventDate__c > 2021-01-01T00:00:00Z | |
Get read-only reference snapshot of SalesObject11 before 2022 | SELECT Id, Name FROM SalesObject11 WHERE CreatedDate < 2022-01-01T00:00:00Z FOR REFERENCE | |
Get SecurityObject10 where SecurityObject10Field4 is in (1976,2783,5196) | SELECT Id, Name FROM SecurityObject10 WHERE SecurityObject10Field4 IN (1976,2783,5196) | |
Find AnalyticsObject16 where Id contains 'Test' | SELECT Id, Name FROM AnalyticsObject16 WHERE Id LIKE '%Test%' | |
TYPEOF example: for WhoId polymorphic, show Contact or Lead fields accordingly for Task | SELECT Id, Subject, TYPEOF Who WHEN Contact THEN LastName, Email WHEN Lead THEN Company, Email END FROM Task WHERE Subject LIKE '%follow%' | |
TYPEOF example: for WhoId polymorphic, show Contact or Lead fields accordingly for Task | SELECT Id, Subject, TYPEOF Who WHEN Contact THEN LastName, Email WHEN Lead THEN Company, Email END FROM Task WHERE Subject LIKE '%follow%' | |
Convert currency for opportunity Amount to corporate currency | SELECT Id, Name, Amount, convertCurrency(Amount) FROM Opportunity WHERE IsClosed = false | |
List Subscription ordered by SubscriptionField3 desc limit 5 | SELECT Id, Name FROM Subscription ORDER BY SubscriptionField3 DESC LIMIT 5 | |
Find ServiceObject14 where ServiceObject14Field4 includes 'Acme' | SELECT Id, Name FROM ServiceObject14 WHERE ServiceObject14Field4 INCLUDES ('Acme') | |
Query big object WorkOrder for records after 2021-01-01 | SELECT Id, EventDate__c, OwnerId__c FROM WorkOrder WHERE EventDate__c > 2021-01-01T00:00:00Z | |
Aggregate total revenue by Status using ROLLUP for Account | SELECT Status, SUM(AnnualRevenue) totalRevenue FROM Account GROUP BY ROLLUP(Status) | |
Find Accounts with Contacts with Cases that have FeedItems containing 'Error' | SELECT Id, Name FROM Account WHERE Id IN (SELECT AccountId FROM Contact WHERE Id IN (SELECT ContactId FROM Case WHERE Id IN (SELECT ParentId FROM FeedItem WHERE Body LIKE '%Error%')) ) | |
Find ExperienceObject19 where ExperienceObject19Field5 contains 'Test' | SELECT Id, Name FROM ExperienceObject19 WHERE ExperienceObject19Field5 LIKE '%Test%' | |
TYPEOF example: for WhoId polymorphic, show Contact or Lead fields accordingly for Task | SELECT Id, Subject, TYPEOF Who WHEN Contact THEN LastName, Email WHEN Lead THEN Company, Email END FROM Task WHERE Subject LIKE '%follow%' | |
Get read-only reference snapshot of AuthSession before 2022 | SELECT Id, Name FROM AuthSession WHERE CreatedDate < 2022-01-01T00:00:00Z FOR REFERENCE | |
Aggregate total revenue by Status using ROLLUP for Account | SELECT Status, SUM(AnnualRevenue) totalRevenue FROM Account GROUP BY ROLLUP(Status) | |
Convert currency for opportunity Amount to corporate currency | SELECT Id, Name, Amount, convertCurrency(Amount) FROM Opportunity WHERE IsClosed = false | |
Get MarketingObject2 where Status is in (8648,4525,8917) | SELECT Id, Name FROM MarketingObject2 WHERE Status IN (8648,4525,8917) | |
Use GROUP BY with multiple fields to summarize revenue | SELECT Industry, Type, SUM(AnnualRevenue) total FROM Account GROUP BY Industry, Type | |
Get read-only reference snapshot of MarketingObject18 before 2022 | SELECT Id, Name FROM MarketingObject18 WHERE CreatedDate < 2022-01-01T00:00:00Z FOR REFERENCE | |
Convert currency for opportunity Amount to corporate currency | SELECT Id, Name, Amount, convertCurrency(Amount) FROM Opportunity WHERE IsClosed = false | |
Query big object SalesObject17 for records after 2021-01-01 | SELECT Id, EventDate__c, OwnerId__c FROM SalesObject17 WHERE EventDate__c > 2021-01-01T00:00:00Z | |
Aggregate total revenue by Type using ROLLUP for Account | SELECT Type, SUM(AnnualRevenue) totalRevenue FROM Account GROUP BY ROLLUP(Type) | |
Find ServiceObject2 where IsActive includes 'Demo' | SELECT Id, Name FROM ServiceObject2 WHERE IsActive INCLUDES ('Demo') | |
Query big object SecurityObject12 for records after 2021-01-01 | SELECT Id, EventDate__c, OwnerId__c FROM SecurityObject12 WHERE EventDate__c > 2021-01-01T00:00:00Z | |
Find Accounts with Contacts with Cases that have FeedItems containing 'Error' | SELECT Id, Name FROM Account WHERE Id IN (SELECT AccountId FROM Contact WHERE Id IN (SELECT ContactId FROM Case WHERE Id IN (SELECT ParentId FROM FeedItem WHERE Body LIKE '%Error%')) ) | |
Aggregate total revenue by Industry using ROLLUP for Account | SELECT Industry, SUM(AnnualRevenue) totalRevenue FROM Account GROUP BY ROLLUP(Industry) | |
Get FieldServiceObject6 for view statistics in last 30 days | SELECT Id, Name FROM FieldServiceObject6 WHERE LastModifiedDate = LAST_N_DAYS:30 FOR VIEW | |
Get read-only reference snapshot of ApptBundleAggrDurDnscale__c before 2022 | SELECT Id, Name FROM ApptBundleAggrDurDnscale__c WHERE CreatedDate < 2022-01-01T00:00:00Z FOR REFERENCE | |
Use GROUP BY with multiple fields to summarize revenue | SELECT Industry, Type, SUM(AnnualRevenue) total FROM Account GROUP BY Industry, Type | |
Show AVG of FieldServiceObject14Field4 grouped by StageName for FieldServiceObject14 | SELECT StageName, AVG(FieldServiceObject14Field4) val FROM FieldServiceObject14 GROUP BY StageName | |
Include soft-deleted rows for Product2 | SELECT Id, Name, IsDeleted FROM Product2 USING SCOPE ALL ROWS | |
Include soft-deleted rows for Entitlement | SELECT Id, Name, IsDeleted FROM Entitlement USING SCOPE ALL ROWS | |
Find SalesObject3 where EndDate contains 'Cloud' | SELECT Id, Name FROM SalesObject3 WHERE EndDate LIKE '%Cloud%' | |
List ExperienceObject3 ordered by ExperienceObject3Field5 desc limit 50 | SELECT Id, Name FROM ExperienceObject3 ORDER BY ExperienceObject3Field5 DESC LIMIT 50 | |
Get Quote for view statistics in last 30 days | SELECT Id, Name FROM Quote WHERE LastModifiedDate = LAST_N_DAYS:30 FOR VIEW | |
Show MAX of Amount grouped by StageName for AccountTeamMember | SELECT StageName, MAX(Amount) val FROM AccountTeamMember GROUP BY StageName | |
Find Accounts with nested related records across 5 levels containing 'Fail' | SELECT Id, Name FROM Account WHERE Id IN (SELECT AccountId FROM Contact WHERE Id IN (SELECT ContactId FROM Case WHERE Id IN (SELECT ParentId FROM FeedItem WHERE Id IN (SELECT ParentId FROM FeedComment WHERE CommentBody LIKE '%Fail%')))) | |
Aggregate total revenue by Status using ROLLUP for Account | SELECT Status, SUM(AnnualRevenue) totalRevenue FROM Account GROUP BY ROLLUP(Status) | |
Include soft-deleted rows for EinsteinObject11 | SELECT Id, Name, IsDeleted FROM EinsteinObject11 USING SCOPE ALL ROWS | |
Aggregate total revenue by Status using ROLLUP for Account | SELECT Status, SUM(AnnualRevenue) totalRevenue FROM Account GROUP BY ROLLUP(Status) | |
Convert currency for opportunity Amount to corporate currency | SELECT Id, Name, Amount, convertCurrency(Amount) FROM Opportunity WHERE IsClosed = false | |
Include soft-deleted rows for FieldServiceObject9 | SELECT Id, Name, IsDeleted FROM FieldServiceObject9 USING SCOPE ALL ROWS | |
Aggregate total revenue by Status using ROLLUP for Account | SELECT Status, SUM(AnnualRevenue) totalRevenue FROM Account GROUP BY ROLLUP(Status) | |
Show AVG of Amount grouped by OwnerId for ServiceObject16 | SELECT OwnerId, AVG(Amount) val FROM ServiceObject16 GROUP BY OwnerId | |
Convert currency for opportunity Amount to corporate currency | SELECT Id, Name, Amount, convertCurrency(Amount) FROM Opportunity WHERE IsClosed = false | |
List FieldServiceObject1 ordered by LastModifiedDate desc limit 100 | SELECT Id, Name FROM FieldServiceObject1 ORDER BY LastModifiedDate DESC LIMIT 100 | |
Use GROUP BY with multiple fields to summarize revenue | SELECT Industry, Type, SUM(AnnualRevenue) total FROM Account GROUP BY Industry, Type |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.