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

Event listening in react

 How we can listen to som eevents some envents fire like click or automatically user enters into input button , that is event on word type i...