logo

Back to questions

Patient Support Analysis (Part 3) [UnitedHealth SQL Interview Question]

Hard

UnitedHealth Group 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 get the patients who made a call within 7 days of their previous call. If a patient called more than twice in a span of 7 days, count them as once.

If you like this question, try out Patient Support Analysis (Part 4)!

Table:

Column NameType
policy_holder_idinteger
case_idvarchar
call_categoryvarchar
call_receivedtimestamp
call_duration_secsinteger
original_orderinteger

Example Input:

policy_holder_idcase_idcall_categorycall_receivedcall_duration_secsoriginal_order
50837000dc63-acae-4f39-bb04claims3/9/2022 2:51205130
5083700041be-bebe-4bd0-a1baIT_support3/12/2022 5:37254129
50837000bab1-3ec5-4867-90aebenefits5/13/2022 18:19228339
5093667412c8-b35c-48a3-b38dclaims5/31/2022 7:2724031
50886837d0b4-8ea7-4b8c-aa8bIT_support3/11/2022 3:3827616
50886837a741-c279-41c0-90ba3/19/2022 10:52131325

Example Output:

patient_count
1

Explanation:

Only patient 50837000 made another call (on March 12th, 2022) within 7 days of the last call (on March 9th, 2022).

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

PostgreSQL 14