You need to sign in to do that
Don't have an account?
what is the use of {} Curly braces and [] Square brackets in soql query ?
whats is the use of {}, [] these to use in soql query, is there any specific use to use ?
can you pls explaine me with query exampls.
thanks in advance.
can you pls explaine me with query exampls.
thanks in advance.
Please find below the link for you query.
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_typos.htm
Hope it will help you.
Mark it as best answer. If it solves your query.
{ }:-
Curly braces group elements to remove ambiguity. For example, in the clause UPDATE {TRACKING|VIEWSTAT}[,...], the curly braces indicate that the pipe shows a choice between TRACKING and VIEWSTAT after UPDATE, rather than a choice between UPDATE TRACKING and VIEWSTAT
[ ] :-
Square brackets indicate an optional element. For example, [LIMIT rows] means that you can specify zero or one LIMIT clause. Don’t type square brackets as part of a SOQL command. Nested square brackets indicate elements that are optional and can only be used if the parent optional element is present. For example, in the clause [ORDER BY fieldOrderByList [ASC | DESC] [NULLS {FIRST | LAST}]] , ASC, DESC, or the NULLS clause cannot be used without the ORDER BY clause.
I have read that before itself but i didn't understand, so that's why i have post a question is there any one explain with examples, what is the significance use of those { }, [] brackets in SOQL Query
thanks
check this another example:-{ }:-
Mostly we see the use of {} in SOSL Queries & [] in SOQL Queries.
Check these links:
{} and [] - https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL.htm
{} - https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_sosl_find.htm
[] - https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select.htm
Check these Trailhead links:
1. .https://developer.salesforce.com/trailhead/en/apex_database/apex_database_soql
2. https://developer.salesforce.com/trailhead/en/apex_database/apex_database_sosl
Kind Regards,
Sourav.
In SOQL syntax, {} brackets means we use any one of options(choice) mentioned in {} And [] brackets means that part is OPTIONAL in query. We can use if required else we can skip that.
See the syntax below...
SELECT fieldList [subquery][...] [TYPEOF typeOfField whenExpression[...] elseExpression END][...] FROM objectType[,...] [USING SCOPE filterScope] [WHERE conditionExpression] [WITH [DATA CATEGORY] filteringExpression] [GROUP BY {fieldGroupByList|ROLLUP (fieldSubtotalGroupByList)|CUBE (fieldSubtotalGroupByList)} [HAVING havingConditionExpression] ] [ORDER BY fieldOrderByList {ASC|DESC} [NULLS {FIRST|LAST}] ] [LIMIT numberOfRowsToReturn] [OFFSET numberOfRowsToSkip] [FOR {VIEW | REFERENCE}[,...] ] [ UPDATE {TRACKING|VIEWSTAT}[,...] ]
here {} & [] used with FOR, that means FOR keyword is an optional keyword...we can use in query or can avoid it BUT whenever we use it then we must have to pass single value (VIEW or REFERENCE) for it.
Hope it is claer to you.
Mark it as best answer. Only if you are satisfied wiht answer,