Banking Contacts with Their Firms

Basic

Relationship managers in the banking vertical want a call sheet of their contacts with the firm each one works for.

Return each Contact's LastName and its account's name (Account.Name) for contacts whose account is in the Banking industry.

Sample data

Account 3 records

NameIndustry
Bluefin BankBanking
Acme CloudTechnology
Harbor CreditBanking

Contact 4 records

LastNameAccount
RaoBluefin Bank
SinghAcme Cloud
PatelHarbor Credit
Iyernull

Expected result on the sample

LastNameAccount.Name
RaoBluefin Bank
PatelHarbor Credit

Row order does not matter. Only the columns above are compared; extra columns in your SELECT are fine.

Hints
  • From Contact, the parent account is Account.
  • You can filter on Account.Industry directly.

What this tests

Dot notation walks from a child record to its parent in one query, both in the SELECT list and in the WHERE clause. It replaces the two-query pattern of loading contacts, collecting AccountIds and querying accounts. A contact with no account simply drops out of a filter on Account.Industry.

SOQL

Run on sample executes your query against the sample data shown on the left and displays the rows it returns. Submit checks it against the sample plus 2 hidden datasets, comparing your rows with the expected rows on each. Queries run in a real Salesforce org; the data is inserted for your run and rolled back afterwards.