Mockbit/#44
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
← Back homemockbit.io/q/44
PrivacyTerms© 2026 Mockbit