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

sun dried potato procedure

  Sun-Dried Potato Chips Recipe  https://www.youtube.com/watch?v=e_PVvAU77Qs , recipe for potato sun dried chips 1) ist peel off the potato ...