Oracle Sql Problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Oracle Sql Problem

Find the names of the customers who have two or more orders with status "pending." Customers(custID, name, email, shipAddr) Orders(orderID, custID, itemID, date, status) Items(itemID, description)

16th Feb 2020, 6:31 PM
Muhammad Mehran Bin Azam
Muhammad Mehran Bin Azam - avatar
2 Answers
0
Join should help. Select Customers.name From Customers Inner join Orders ON Customers.custID=Orders.custId Where Orders.status = "pending"; If not exactly, it should be something similar to the above query.
16th Feb 2020, 6:45 PM
Avinesh
Avinesh - avatar
0
"two or more" sounds like the important part select c.name from customers c join ( select custID, count(*) from orders where status='pending' group by custID having count(*)>=2 ) o on o.custID = c.custID
16th Feb 2020, 8:31 PM
Tibor Santa
Tibor Santa - avatar