What will be the output of this Query?
select to_char(trunc(add_months(sysdate-3),mm),mm/dd/yyyy) from dual
Answer Posted / praveen
Let sysdate=30/07/2012;
let see dis query
select add_months(sysdate,-3) from dual;
//ans=07/30/2012-mm/dd/yyyy
select trunc(add_months(sysdate,-3),'mm') from dual;
//ans=07/01/2012-mm/dd/yyyy
select to_char(trunc(add_months(sysdate,-3),'mm'),'mm/dd/yyyy from dual;
//ans=07/01/2012-mm/dd/yyyy
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What is nosql db?
Explain what is sql?
How do you delete a table?
What is an index in sql with example?
How consistent is the view of the data between and within multiple sessions, transactions or statements ?
What is the difference between cluster and non-cluster index?
What is difference between inner join and self join?
how to calculate expressions with sql statements? : Sql dba
Which is better cte or subquery?
how can we encrypt and decrypt a data present in a mysql table using mysql? : Sql dba
What is rownum?
what are string data types? : Sql dba
What is sql data?
What is the syntax and use of the coalesce function?
How does sql profiler work?