Q. Write Query statements for following transaction : (Consider tables of question 6)

(i). Increase price of all products by 10%.

(ii). List the details of all orders whose payment is pending as per increased price.

(iii). Decrease prices by 10% for all those products for which orders were placed 10 months before.

 

Answer :-


(i). Update product
Set price = price + price * 0.10


(ii)

Select * from orders, product, payment where orders.OrdNo = Payment.OrdNo and ProdNo# = ProdNo and ( Qty * Price ) < Pment ;


(iii) UPDATE Product
SET Price=Price - Price*0.1
WHERE Product.ProdNo=Orders.ProdNo AND DATEDIFF(month, Orders.Ord_date, GETDATE())>=10;

13 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. Kindly post the answer brother

    ReplyDelete
  2. for the iii question in the above if the date is given, how will we write a query for that?

    ReplyDelete
    Replies
    1. Simple, this question will never comes in your exam, So don't worry.

      Delete
  3. Sir shouldn't we give Orders.ProdNo#=Product.ProdNo instead of ProdNo# = ProdNo

    ReplyDelete
    Replies
    1. please give me explanation of 2 answer

      Delete
  4. Are u sure that the iii is right???🤔

    ReplyDelete
    Replies
    1. Yes, If you have doubt then you can ask to your subject teacher.

      Delete
  5. (iii) UPDATE Product
    SET Price=Price - Price*0.1
    WHERE Product.ProdNo=Orders.ProdNo AND DATEDIFF(month, Orders.Ord_date, GETDATE())>=10;

    ReplyDelete
  6. Pls explain the (iii) one

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post