-- Given a table sales with columns sale_id, product_id, quantity, 
-- and sale_date, write an SQL query to find the total quantity of each product sold in January 2024.

CREATE TABLE sales (
    sale_id INT,
    product_id INT,
    quantity INT,
    sale_date DATE
);

INSERT INTO sales(sale_id,product_id,quantity,sale_date) values
(1,101,24,"2024-01-12"),
(2,102,25,"2024-01-15"),
(3,103,50,"2024-01-16"),
(4,105,200,"2024-01-17");

select product_id,sum(quantity) as totalquantity
from sales
where sale_date>="2024-01-01" and sale_date<"2024-02-01"
grouo by product_id;

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: