krajnish95/SOQL-dataset
SOQL Mega Dataset Documentation This document explains the contents of the 15,000βrecord SOQL training dataset.It summarizes what type of SOQL queries, which Salesforce objects, and which SOQL features are included. π 1. Dataset Overview File Name: soql_dataset_full_15000.json Total Records: 15,000 Format for each entry: { "instruction": "<plain English instruction>", "input": "", "output": "<SOQL query>" } Designed specifically for LLM training toβ¦ See the full description on the dataset page: https://huggingface.co/datasets/krajnish95/SOQL-dataset.
SOQL Mega Dataset Documentation
This document explains the contents of the 15,000βrecord SOQL training dataset. It summarizes what type of SOQL queries, which Salesforce objects, and which SOQL features are included.
π 1. Dataset Overview
- File Name:
soql_dataset_full_15000.json - Total Records: 15,000
- Format for each entry:
{
"instruction": "<plain English instruction>",
"input": "",
"output": "<SOQL query>"
}- Designed specifically for LLM training to convert natural language β SOQL.
π 2. Salesforce Clouds Covered
The dataset includes SOQL examples from all major Salesforce clouds:
β Sales Cloud
Account, Contact, Lead, Opportunity, OpportunityLineItem Product2, Pricebook2, PricebookEntry Campaign, CampaignMember, Quote, QuoteLineItem Order, OrderItem, Contract, Asset, User
β Service Cloud
Case, CaseComment, Solution EmailMessage, LiveChatTranscript, LiveChatVisitor Entitlement, EntitlementProcess
β Field Service
WorkOrder, WorkOrderLineItem ServiceAppointment, ServiceResource ServiceTerritory, ServiceTerritoryMember WorkType, RoutingRule
β CPQ
SBQQ_Quotec, SBQQQuoteLine_c ContractedPrice, Subscription
β Marketing / Pardot
ListEmail EmailTemplate PardotProspectc MarketingForm_c
β Commerce Cloud
Cart_c, CartItemc InventoryItemc ProductCategory_c
β Experience Cloud
Network, NetworkMember Site, AuthSession UserPreference
β Einstein / AI / Analytics
PredictionResult_c MlRecommendationc EinsteinActivityc Dataset_x
β Content / Knowledge
KnowledgeArticleVersion Knowledge__kav ContentVersion, ContentDocument
β Security & Metadata
PermissionSet, PermissionSetAssignment AccountShare, ContactShare, OpportunityShare CustomMetadata_mdt, CustomPermission_c ApexClass, ApexTrigger, Layout
β Big Objects
EventArchive_b CustomerActivityb LoginHistoryArchiveb CaseHistoryArchive_b
β Custom Objects (examples)
Invoice_c InvoiceLinec CreditMemoLinec ConsumptionRatec Documentc ApptBundleAggrDurDnscale_c
β 200+ Synthetic Platform Objects
To generalize LLM behavior:
- SalesObject1 β¦ SalesObject20
- ServiceObject1 β¦ ServiceObject20
- CPQObject1 β¦ CPQObject20
- etc.
π 3. SOQL Query Types Covered
β Basic SELECT Queries
- Simple equality
- Numeric comparisons
- String filters
- Email filters
- Null checks (
= NULL,!= NULL)
β WHERE Clause Variants
LIKE '%keyword%'IN (1,2,3)INCLUDES ('Value')(multi-select picklists)- Date filters
- Date literals:
LAST_N_DAYS:30,YESTERDAY,THIS_YEAR
π 4. Aggregates Included
β Aggregate Functions
COUNT()COUNT_DISTINCT()SUM()AVG()MAX()MIN()
β GROUP BY / HAVING
Examples include:
SELECT StageName, COUNT(Id) FROM Opportunity GROUP BY StageName
SELECT Industry, SUM(AnnualRevenue) FROM Account GROUP BY Industry HAVING SUM(AnnualRevenue) > 1000000β ROLLUP & GROUPING
Examples:
SELECT Industry, Type, SUM(AnnualRevenue) FROM Account GROUP BY ROLLUP(Industry, Type)
SELECT Industry, GROUPING(Industry) grp FROM Account GROUP BY ROLLUP(Industry)π 5. Advanced SOQL Features
β TYPEOF
Polymorphic queries for WhoId / WhatId:
TYPEOF Who WHEN Contact THEN LastName, Email WHEN Lead THEN Company ENDβ USING SCOPE ALL ROWS
Soft-deleted record access.
β FOR VIEW / FOR REFERENCE / FOR UPDATE
FOR VIEW(view stats)FOR REFERENCE(read-only snapshot)FOR UPDATE(record locking)
π 6. Relationship Queries
β Parent β Child Subqueries
SELECT Name, (SELECT Subject FROM Case WHERE Status = 'New') FROM Accountβ Semi-Join / Anti-Join
SELECT Id FROM Account WHERE Id IN (SELECT AccountId FROM Contact)
SELECT Id FROM Account WHERE Id NOT IN (SELECT AccountId FROM Opportunity)β Deep Multi-Level Chains (3β5 levels)
Examples include:
- Account β Contact β Case β CaseComment
- Account β Contact β Case β FeedItem β FeedComment
- Account β Opportunity β OpportunityLineItem β Product2
π 7. Big Object Queries
SELECT Id, EventDate__c FROM EventArchive__b WHERE EventDate__c > 2021-01-01T00:00:00ZBig objects use restricted SOQL, which is represented in the dataset.
π 8. Query Variations Included
ORDER BYLIMITOFFSETFIELDS(ALL)- Currency conversion:
convertCurrency() - Timezone conversion:
convertTimezone()
π 9. Dataset Goals
This dataset was intentionally built to help LLMs learn:
- Convert plain English instructions β valid SOQL.
- Understand objects, fields, and query patterns.
- Handle complex SOQL operations & multi-object reasoning.
- Work with both standard & custom object patterns.
- Generalize to unseen objects using synthetic ones.
β Final Notes
- The dataset intentionally mixes real + synthetic objects to maximize generalization.
- All SOQL examples are syntactically plausible and demonstrate Salesforce querying concepts.
- You can safely fineβtune any LLM or RAG system using this dataset.
license: mit ---
