0 votes
in Oracle by
Imagine you have an Inventory table with product_id and quantity columns. Write an Oracle SQL query to find the products that have experienced an increase in quantity compared to the previous month.

1 Answer

0 votes
by
SELECT product_id

FROM (

    SELECT product_id, quantity, LAG(quantity) OVER (ORDER BY month) AS prev_quantity

    FROM Inventory

)

WHERE quantity > prev_quantity;

Related questions

0 votes
asked Jan 21 in Oracle by rajeshsharma
0 votes
asked Mar 24, 2022 in SAP S/4HANA Technical Capabilities 1909 by sharadyadav1986
...