Set Operators

Set operators: UNION, INTERSECT, and EXCEPT, help combine or compare query results.

Example:

SELECT PatientID FROM InpatientList
UNION
SELECT PatientID FROM OutpatientList;

This merges patients from both lists.

💡 Future clinical idea: Use INTERSECT to identify patients who are both in a high-risk med list and have a recent adverse event record.

Leave a Reply

Your email address will not be published. Required fields are marked *