Skip to content
Advertisement

2 SELECT with INTERSECT or 2 condition with WHERE

I have a task that “Get the makers producing both PCs having a speed of 750 MHz or higher and laptops with a speed of 750 MHz or higher. Result set: maker” from https://www.sql-ex.ru

For this task I wrote this query which is return nothing (empty screen)

But the right query is

I wonder what is the differences between these two queries and why my query doesn’t get the true output.

Advertisement

Answer

Your version requires that the same product have both characteristics. This is probably not possible — because the same model would need to be both a PC and a laptop.

The intersect version allows the characteristics to be on different products.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement