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
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;
SET Price=Price - Price*0.1
WHERE Product.ProdNo=Orders.ProdNo AND DATEDIFF(month, Orders.Ord_date, GETDATE())>=10;
Ans yet not posted
ReplyDeletePlease check again.
DeleteKindly post the answer brother
ReplyDeleteOk, I have posted the answer : )
Deletefor the iii question in the above if the date is given, how will we write a query for that?
ReplyDeleteSimple, this question will never comes in your exam, So don't worry.
DeleteSir shouldn't we give Orders.ProdNo#=Product.ProdNo instead of ProdNo# = ProdNo
ReplyDeleteplease give me explanation of 2 answer
DeleteAre u sure that the iii is right???🤔
ReplyDeleteYes, If you have doubt then you can ask to your subject teacher.
Delete(iii) UPDATE Product
ReplyDeleteSET Price=Price - Price*0.1
WHERE Product.ProdNo=Orders.ProdNo AND DATEDIFF(month, Orders.Ord_date, GETDATE())>=10;
Thank you for answering.
DeletePls explain the (iii) one
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )