•Maybe, nothing is wrong with this query.
•Possibly, the DISTINCT is just a back-handed
way to get a necessary sort.
•Possibly, the sort is
unnecessary and is a (probably mild) waste of time.
•However, the DISTINCT may be a red flag pointing to
a hidden many-to-many join.
SELECT DISTINCT O.Order_ID, O.Order_Date,
C.Name, L.Line_ID, L.Quantity, I.Name
FROM Orders O,
Order_Lines L, Items I, Customers C
WHERE O.Customer_ID =
:B1
AND L.Order_ID =
O.Order_ID
AND I.Item_ID =
L.Item_ID
AND C.Customer_ID =
O.Customer_ID;