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

create cartoon video using ai

  https://www.piclumen.com/ using this we can crate cartoon photos https://hailuoai.video/ its not free upto 1000 points we canuse it for fr...