I am working on a NOT EXISTS and it is not turning out like it is supposed to. There should only be 2 results that should have showed up but I got 18. I am supposed to find all book titles (as ‘book title’) that have not had any sales in the database. For some reason I think I am forgetting something in the query but I am not sure. I don’t understand why it’s not working correctly.
Select title AS 'Book Title'
From titles
WHERE NOT EXISTS
(Select ord_num
From sales
Where title = ord_num)
It looks as though you are trying to find sales records where the title is the same as the order number, in your
EXISTSclause. I suggest something like: