Assuming I’m using a model like this
How would I be able to find the last customer to order a give product?

I got this far
SELECT customerNumber
FROM ORDERS
WHERE orderNumber = (SELECT TOP 1 OrderNumber FROM orderDetails WHERE productCode = 1
ORDER BY orderDate DESCENDING)
Now I’m stuck. Not sure what subquery(s) should be.
The way you should think of it is that it’s sufficient to retrieve just the customerNumber and the productCode because the details associated with those can be retrieved with a simple join (or even via another query from your front end code if that’s how your front end works).
You can sort the list of orders by orderDate descending, and grab the first one.
So then you get:
If you create a “descending” index on Orders.orderDate, ie:
then the query will even be really fast as Oracle will use the index instead of sorting again.