Deviopath › PostgreSQL

Back Again in February

Medium · Set Operations

INTERSECT keeps only the rows that both queries return, and EXCEPT keeps rows from the first query that the second one does not return. Both remove duplicates.

Return the name of every customer who placed at least one order (any status) in January 2026 AND at least one order in February 2026. Sort by name.

Next: Members in Good Standing