- 5
Please sorry my friends, I'm coming back
You are managing a delivery office and need to prioritize your orders. Order is considered a high priority order if - the purchase total exceeds $400 and - the customer's age is greater than 40 or the distance from the office to the delivery point is under 10 miles. You are given the following 'orders' table with details:
5 Respostas
+ 1
SELECT * FROM Orders
WHERE (Age > 40 OR Distance < 10)
AND Price > 400
ORDER BY Price;
0
And what are your thoughts on how the query should look?
0
SELECT * FROM Orders
WHERE Price > 400
AND Age > 40 OR Distance < 10
ORDER BY Price;
0
Notice that the problem description implies there should be parentheses around the OR expression.
(Age > 40 OR Distance < 10)
Even if Age<=40 it will still be high priority if Distance<10 miles.
0
Let me see