
Sean Flanagan
33,225 PointsTask 2
Hi. I used the EXCEPT operator for this task but I couldn't exclude books that were in both tables.
-- Create a list of unique books.
-- Books that are in the north or south location, but not in both locations.
SELECT * FROM books_north
EXCEPT
SELECT * FROM books_south
Am I doing something wrong?
1 Answer

Mustafa Başaran
28,020 Points<Query1> EXCEPT <Query2> returns all rows in Query1 that are NOT retrieved in Query2. This is NOT going to return unique books.
On the other hand, <Query1> UNION <Query2> will get ALL rows in Query1 and Query2. Moreover, there will be no DUPLICATE rows.. So, the returned rows will be UNIQUE.
Rich Donnellan
Treehouse Moderator 25,740 PointsRich Donnellan
Treehouse Moderator 25,740 PointsHey Sean,
I suggest rewatching the videos (maybe multiple times?) until the concept starts to click. Posting back-to-back questions on the same topic should be a last resort.