会社にはカスタム オブジェクト Order__c があり、そのカスタム選択リスト フィールド Status__c の値は「New」、「In Progress」、または「Fulfilled」、および参照フィールド Contact__c は Contact です。
「履行済み」注文がないすべての取引先責任者レコードの一意のリストを返す SOQL クエリはどれですか?
正解:A
Option A is the correct SOQL query that will return a unique list of all the Contact records that have no 'Fulfilled' Orders. Option A uses a subquery to filter the Contact records based on the related Order__c records. The subquery uses the NOT IN operator to exclude the Order__c records that have the Status__c value of 'Fulfilled'. The subquery also uses the SELECT Id clause to return only the Ids of the Order__c records, which is more efficient than returning all the fields. The main query uses the DISTINCT keyword to return only the unique Contact records, and the ORDER BY clause to sort the records by the Name field. The query also uses the SELECT Id, Name clause to return only the Id and Name fields of the Contact records, which is more efficient than returning all the fields. The query also uses the LIMIT 100 clause to limit the number of records returned to 100, which is a good practice to avoid hitting the governor limits. Reference: [SOQL Subqueries], [SOQL SELECT Clause], [SOQL Functions]