Here I asked a question about a non-working request.
By chance (with a single answer) I found how to solve the problem correctly. The problem is that I do not understand why they give different results.
So, the database has the following schema:

And I am looking for all the models from PC , Printer and Laptop with the highest price. All these tables can have a unique model column, since elements with different code can have the same model.
My initial decision was:
with model_price(model,price) as ( select model,price from PC union select model,price from Laptop union select model,price from Printer ) select model from model_price where price >= all(select price from model_price)
He gave the wrong result - the system returned * Wrong number of records (less by 2) .
The corrected solution that works is this:
with model_price(model,price) as ( select model,price from PC union select model,price from Laptop union select model,price from Printer ) select model from model_price where price = (select max(price) from model_price)
So why does a solution with all give an excellent result?
About the sql engine: Now we use Microsoft SQL Server 2012 on the rating stages, and MySQL 5.5.11, PostgreSQL 9.0, and Oracle Database 11g on the learn stage in addition. So I donβt know which engine he uses to illuminate this exercise.
source share