Q. Show via query how many days remain until Christmas. Round fractional days up using the numeric function ROUND.

 

 Answer :-

Here we can use DATEDIFF( ) function. By Round ( ) method it become very complex.

So, Query is 


SELECT   DATEDIFF ( '2021-12-25' , curdate ( ) ) ; 


9 Comments

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

  1. PLZZ tell me the answer of this question . It is not visible

    ReplyDelete
  2. Where is the answer please upload it asap

    ReplyDelete
  3. SELECT ROUND(DAY('2021–12–25')-DAY(CURDATE()));

    ReplyDelete
    Replies
    1. then days will act like integers and you will not get result

      Delete
  4. select dayofyear('2024-12-25')-dayofyear(sysdate())-Round(((hour(curtime())*60*60)+(minute(curtime())*60)+(minute(curtime())))/(24*60*60)) "Days to Chrisitmas";

    This i thought...

    ReplyDelete
    Replies
    1. complex i think... round ke andar wala function is for the following purpose: find the second of day(number of hours passed*60*60+minutes*60+secinds) and if more than 12 hours have passed , then the value returned is 1.
      initial part se number of days left aaega

      Delete
    2. instead we can just use: round(hour(curtime())/24)

      Delete

Post a Comment

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

Previous Post Next Post