Dbms Lab Problem Solution
Dbms Lab Problem Solution
customer_name varchar2(255),
gender varchar2(255));
desc customer
item_name varchar2(255),
item_price number,
sold_date date,
sold_quantity number,
item_category varchar2(255),
item_company varchar2(255));
desc item
(c)create seller table
seller_name varchar2(255),
sell_quantity number);
desc seller
item_replaced_status varchar2(255),
order_quantity number,
order_date date,
payment_mode varchar2(255),
bank_name varchar2(255));
desc orders
(e)Insert data into customer table
Q1. List the customers who have ordered Redmi 9 pro smartphone.
Q2. List customers who have ordered the items above 10000 and dispaly the item too
WHERE i.item_price>10000;
Q3. List the items which have been sold out more in number from October to December.
Q4. List the items which have been replaced by the customers.
WHERE item_replaced_status='yes';
Q5. List the items which are from 2000 to 3000 rs.
Q7. List the customers who have ordered the item through netbanking.
WHERE o.payment_mode='netbanking';
Q8. List the sellers who have sold the mobile phone more than 1000 pieces.
WHERE sell_quantity>1000;
Q9. Count the female and male customers who have purchased ornaments.
Q10. Count the female customers who have purchased the men items.
Q11. List the Item which have been sold in second largest number.
FROM customer c
GROUP BY c.customer_name
Q13. Find the customers who have purchased maximum number of mobile phones for a particular
company.
FROM customer c
AND o.order_quantity = (
SELECT MAX(order_quantity)
FROM orders o1
GROUP BY i.item_company,c.customer_name,o.order_quantity;
Q14. Find the item which have been sold maximum in number.
Q15. Find the bank name which has maximum selling point through any transaction.
=> SELECT bank_name from orders where order_quantity=(select max(order_quantity) from orders);
Q16. List the customers who have used both the ttansaction mode as UPI and Netbanking for SBI
bank.
FROM customer c