SQL ANY, ALL mistake by W3Schools in SQL Posted September 10, 2020 Question: The following SQL statement returns TRUE and lists the product names if it finds ANY records in the OrderDetails table that quantity = 10 Answer by W3Schools.com SELECT ProductNameFROM ProductsWHERE ProductID = ANY (SELECT ProductID FROM OrderDetails WHERE Quantity = 10); which is wrong, as the result showing by above query is 31, but right answer will be 44 select productname, quantity from products inner join orderdetails on products.productid=orderdetails.productid and quantity=10 order by productname please verify and confirm.
SQL ANY, ALL mistake by W3Schools
in SQL
Posted
Question:
The following SQL statement returns TRUE and lists the product names if it finds ANY records in the OrderDetails table that quantity = 10
Answer by W3Schools.com
SELECT ProductName
FROM Products
WHERE ProductID = ANY (SELECT ProductID FROM OrderDetails WHERE Quantity = 10);
which is wrong, as the result showing by above query is 31, but right answer will be 44
select productname, quantity
from products
inner join orderdetails on products.productid=orderdetails.productid and quantity=10
order by productname
please verify and confirm.