Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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
229,952 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.