with
t1 as(
    select
        customer_id,
        customer_name,
        product_name,
        rank()over(partition by customer_id order by order_date desc) as crank
    from
        orders
        left join customers using(customer_id)
        left join products using(product_id)
)
,
t2 as(
    select
        customer_id,
        customer_name,
        product_name as latest_order
    from
        t1
    where
        crank=1
    order by
        customer_id
)

select * from t2