Back to questions

Uniquely Staffed Consultants Accenture SQL Interview Question

Uniquely Staffed Consultants

Accenture SQL Interview Question

As a Data Analyst on the People Operations team at Accenture, you are tasked with understanding how many consultants are staffed to each client, and specifically how many consultants are exclusively staffed to a single client.

Write a query that displays the client name along with the total number of consultants attached to each client, and the number of consultants who are exclusively staffed to each client (consultants working exclusively for that client). Ensure the results are ordered alphabetically by client name.

As of July 5th, the datasets have been expanded to cover edge cases and the solutions have been revised accordingly.

Table:

Column NameType
employee_idinteger
engagement_idinteger

Example Input:

employee_idengagement_id
10011
10012
10021
10028
10033
10034
10043
10044
10055
10056
10057

Table:

Column NameType
engagement_idinteger
project_namestring
client_namestring

Example Input:

engagement_idproject_nameclient_name
1SAP Logistics ModernizationDepartment of Defense
2Oracle Cloud MigrationDepartment of Education
3Trust & Safety OperationsGoogle
4SAP IoT Cloud IntegrationGoogle

Example Output:

client_nametotal_consultantssingle_client_consultants
Department of Defense21
Department of Education10
Google22

Explanation:

  • Department of Defense: Total consultants are 2 (1001 and 1002), and 1 consultant (1002) is exclusively staffed.
  • Department of Education: Total consultant is 1 (1001), but not exclusively staffed as 1002 is also staffed to engagement ID 8.
  • Google: Total consultants are 2 (1003 and 1004), and both consultants are exclusively staffed.

The dataset you are querying against may have different input & output - this is just an example!

Input

Output