Professional Documents
Culture Documents
My solution:
Customer Table
Item Table
Sale Table
c) List all the bills for the current date with the customer names and item numbers
select c.custname, i.itemid, s.billno from customer c, item i, sale s where
c.custid=s.custid and s.billdate=to_char(sysdate);
My solution:
d) List the total Bill details with the quantity sold, price of the item and the final amount.
e) List the details of the customer who have bought a product which has a price>200
select c.custid, c.custname from customer c, sale s, item i where i.price>200 and
c.custid=s.custid and i.itemid=s.itemid;
My solution:
f) Give a count of how many products have been bought by each customer.
select custid, count(itemid) from sale group by custid;
My solution:
My solution:
My solution:
i) Create a view which lists out the bill_no, bill_date, cust_id, item_id, price, qty_sold,
amount.
create view cust as (select s.billno, s.billdate, c.custid, i. iitemid, i.price, s.qty from
customer c,sale s item I where c.custid=s.custid and i.iemid=s.itemid);
My solution:
j) Create a view which lists the daily sales date wise for the last one week
My solution: