the customer name who has placed the first order? What is the name of product that has been ordered by that customer? in sql

 SELECT c.name AS customer_name, p.name AS product_name

FROM customers AS c

JOIN orders AS o ON c.customer_id = o.customer_id

JOIN order_items AS oi ON o.order_id = oi.order_id

JOIN products AS p ON oi.product_id = p.product_id

WHERE o.order_id = (

    SELECT MIN(order_id)

    FROM orders

);


No comments:

Post a Comment

what is systems manager

 = session connect ayinappudu cloud watch lo store ayyi vuntadhi = https://us-east-1.console.aws.amazon.com/systems-manager/session-manager/...