Databases Querying Relational Databases Set Operations Review and Practice

Danny Zhang
Danny Zhang
2,014 Points

EXCEPT will return duplicate rows in table 1? or just unique rows in table 1?

select * from table 1 except select * from table 2

what if there are duplicate rows in table 1 but not in table 2? what will this query return?

1 Answer

Steven Parker
Steven Parker
201,933 Points

EXCEPT will only return unique items from table 1 that are not in table 2.

This came up recently in this other question where I explain that the video examples for EXCEPT are incorrect, and show a correct Venn diagram for it.