SQLeasySubqueries~12m
A medical clinic wants to identify patients who have been prescribed medications...
Problem
A medical clinic wants to identify patients who have been prescribed medications by multiple different providers. Write a query to find all patients who have received prescriptions from at least 2 different providers. Return the patient ID, patient name, and the count of unique providers who have prescribed medications to them. Only include patients who meet the criteria (2+ providers).
Examples
Example 1
Example 2
Constraints
- ›Return patient_id, name, and provider_count
- ›Only include patients with 2 or more unique providers
- ›Order results by patient_id ascending
Reference solution
Reference solution available after you attempt the question.
Ready to solve it?
Start a session on Mockbit #44. Write your SQL, run it against real data, and get graded on correctness, efficiency, query structure, and business understanding.
Related SQL questions
- #41You're analyzing user engagement for a social media platformeasy
- #43A regional bank wants to analyze account activity by branch locationeasy
- #45A mobile gaming company wants to identify the top 3 most active players for each...easy
- #42A video streaming platform tracks user viewing sessionshard
- #46A streaming platform wants to identify content that's experiencing 'viewership...medium
← Back homemockbit.io/q/44