Login
Remember
Register
Ask a Question
Imagine you have an Inventory table with product_id and quantity columns
0
votes
asked
Jan 23, 2024
in
Oracle
by
SakshiSharma
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.
oracle-query
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Jan 23, 2024
by
SakshiSharma
SELECT product_id
FROM (
SELECT product_id, quantity, LAG(quantity) OVER (ORDER BY month) AS prev_quantity
FROM Inventory
)
WHERE quantity > prev_quantity;
...