Learning set operators in SQL today reminded me of Venn diagrams. They let you combine or compare results from multiple queries:
- UNION – merges results, removing duplicates.
- INTERSECT – returns only rows that appear in both results.
- EXCEPT – returns rows from the first query that aren’t in the second.
💡 Practical Example Idea: Compare medication order lists between two facilities to see common treatments (INTERSECT) or unique ones (EXCEPT).
For now, it’s just theory and small sample data, but I’m starting to picture how this could be used for comparing clinical protocols or identifying gaps in care.