Newer Version Available

This content describes an older version of this product. View Latest

SOQL Typographical Conventions

Topics about SOQL use the following typographical conventions:
Convention Description
SELECT Name FROM Account In an example, Courier font indicates items that you should type as shown. In a syntax statement, Courier font also indicates items that you should type as shown, except for question marks and square brackets.
SELECT fieldname FROM objectname In an example or syntax statement, italics represent variables. You supply the actual value.
? In a syntax statement, the question mark indicates the element preceding it is optional. You may omit the element or include one.
WHERE [conditionexpression] In a syntax statement, square brackets surround an element that may be repeated up to the limits for that element. You may omit the element, or include one or more of them.
SELECT Name FROM Account In some examples, particular elements are highlighted with bold if they are of particular interest in the text before or after the example.

Alias Notation

You can use alias notation in SELECT queries:
1SELECT count()
2FROM Contact c, c.Account a
3WHERE a.name = 'MyriadPubs'

To establish the alias, first identify the object, in this example a contact, and then specify the alias, in this case “c.” For the rest of the SELECT statement, you can use the alias in place of the object or field name.

The following are SOQL keywords that can’t be used as alias names: AND, ASC, DESC, EXCLUDES, FIRST, FROM, GROUP, HAVING, IN, INCLUDES, LAST, LIKE, LIMIT, NOT, NULL, NULLS, OR, SELECT, WHERE, WITH