create table Products(
ID int(4),
ProductName varchar(40),
Price int(10),
Quantity int(4),
Profit DECIMAL(4,2),
Discount DECIMAL(4,2),
DateOfPurchase Date
);
Insert into Products values(1,"Keyboard",1500,15,5.00,10.00,'2018-05-21');
Insert into Products values(2,"Mouse",550,10,3.00,5.00,'2018-11-19');
Insert into Products values(3,"Monitor",12000,5,8.00,12.00,'2018-07-15');
Insert into Products values(4,"RAM",2500,8,7.00,10.00,'2018-12-10');
Insert into Products values(5,"SSD",4000,12,15.00,8.00,'2020-02-20');
Insert into Products (ID,ProductName, Price, Quantity, Discount, DateOfPurchase) values(6,"Graphics Card",200000.00,3,10.00,'2019-03-22');
-- Display details of all products.
select * from Products;
-- 2. Display ProductID, ProductName, and DateOfPurchase of all products.
select ID from Products;
select ProductName from Products;
select DateOfPurchase from Products;
-- 3. Display details of all products whose Price is less than 3000.
select ID,ProductName,Price,Quantity,Profit,Discount, DateOfPurchase from Products
where Price < 3000;
-- 4. Display details of all products whose DateOfPurchase is before '2019-01-01'.
select ID,ProductName,Price,Quantity,Profit,Discount,DateOfPurchase from Products
where DateOfPurchase <= '2019-01-01';
-- 5. Display Profit and Discount of products whose DateOfPurchase is after '2018-06-25'.
select Profit,Discount from Products
where DateOfPurchase >= '2018-06-25';
-- 6. Display the detail of all products whose Profit is NULL.
select ID,ProductName,Price,Quantity,Profit,Discount,DateOfPurchase from Products
where Profit = NULL;
-- 7. Display ProductID and ProductName of all products whose Profit is not NULL.
select ID,ProductName from Products
where Profit = NULL;
-- 8. Display the Price of various products. A Price should appear only once.
select Price from Products;
-- 9. Display the detail of all products whose Profit is more than 10 and Discount is less than 15.
select ID,ProductName,Price,Quantity,Profit,Discount,DateOfPurchase from Products
where Profit > 10 && Discount < 15;
-- Display ProductName and Price of all products whose ProductID is not 3.
select ProductName,Price from Products
where ID != 3;
-- 2. Display ProductName and Quantity of all products whose Price is not equal to 3000 or Profit is 10.
select ProductName,Quantity from Products
where Price != 3000 || Profit = 10;
-- 3. Display the detail of all products which are purchased in 2018.
select ID, ProductName,Price,Quantity,Profit,Discount,DateOfPurchase from Products
where year(DateOfPurchase) = "2018";
-- 4. Display the details of all products whose Price is more than 2000 and less than 4000.
select ID,ProductName,Price, Quantity,Profit,Discount,DateOfPurchase from Products
where Price > 2000 & Price < 4000;
-- 5. Display ProductID, ProductName, and Quantity of all products whose Quantity is between 10 and 20 (inclusive).
select ID,ProductName,Price, Quantity,Profit,Discount,DateOfPurchase from Products
where Quantity > 10 && Quantity < 20;
-- 6. Display the detail of Keyboard, Mouse, and RAM.
select * from Products
where ProductName = "Keyboard" or ProductName = "Mouse" or ProductName = "RAM";
-- 7. Display ProductName and Quantity of products whose Price is 730 or 550.
select ID,ProductName,Price, Quantity,Profit,Discount,DateOfPurchase from Products
where Price = 730 || Price = 550;
-- 8. Display Profit and DateOfPurchase of products whose name ends with 'd'.
select Profit, DateOfPurchase from Products
where ProductName like "%d";
-- 1. Display details of all products whose Price is more than 2000 and name contains 'a'.
select ID,ProductName,Price, Quantity,Profit,Discount,DateOfPurchase from Products
where ProductName like "a" && Price >= 2000;
-- 2. Display ProductName, Profit, and Discount of all products whose name does not contain 'e' as the second alphabet.
select Pro
-- 3. Display details of all products in ascending order of Price.
-- 4. Increase the Price by 2 of all products whose Profit is less than 10.
-- 5. Display the total amount (Price * Quantity) for all products.
-- 6. Delete all the products which are purchased in the year 2018.
-- 7. Delete all products which are purchased after January 2018 and Profit is less than 1.
-- 8. Delete the record of products Keyboard and Mouse.
-- 9. Delete all the records from the Product table.
-- 1. Display the structure of the Product table.
-- 2. Add a column named 'Tax' of type INT(2) in the Product table.
-- 3. Delete the 'Tax' column from the Product table.
-- 4. Display the total sum of the Price column from the Product table.
-- 5. Count the number of products whose Price is more than 1000.
-- 6. Display the detail of the most expensive (costliest) product.
-- 7. Display the detail of the least expensive (cheapest) product.
-- 8. Display the number of products with a quantity of more than 5.
-- 9. Update the discount to 5% for all products with a price greater than 5000.
To embed this project on your website, copy the following code and paste it into your website's HTML: