Back to questions
UnitedHealth has a program called Advocate4Me, which allows members to call an advocate and receive support for their health care needs – whether that's behavioural, clinical, well-being, health care financing, benefits, claims or pharmacy help.
Write a query to find how many UHG members made 3 or more calls. column uniquely identifies each call made.
If you like this question, try out Patient Support Analysis (Part 2)!
The only caller who made 3 or more calls is member ID 50837000.
The dataset you are querying against may have different input & output - this is just an example!
First, we identify who called and how frequently.
clause can be used to generate the groups. Since we need the information for members, we group them based on the column.
Note that members are used interchangeably with policy holders but they mean the same.
Next, we apply an aggregate function , which counts the number of values in the column for each policy holder-group.
Displaying records for policy holder IDs 53578035 and 54126242:
In contrast to member 54126242, who has reportedly made five calls, member 51983251 has only made one call.
Then, a conditional clause with the keyword can be applied to keep rows with members who called 3 or more times. clause is used to filter group rows. This sets it apart from a clause that filters individual rows.
Only member 54126242 is in the result because this member made five calls.
Finally, we obtain the count of members using another function. Before the function can be used, the previous query must first be encapsulated in a subquery.
A subquery is a nested query. It’s a query within a query and can be used within that query only. Read here for more understanding.
Output based on the table above:
Solution #2: Using CTE