Difference between NOW(), SYSDATE() & CURRENT_DATE() in MySQL

What difference between NOW() , SYSDATE() , CURRENT_DATE() in MySQL and where it can be used in real scenario .

I tried NOW(),SYSDATE(),Current_Date() when I insert data into a table and column datatype is TIMESTAMP all are given same date and time.

Answers


Current_date() will only give you the date. now() give you the datetime when the statement,procedure etc... started. sysdate() give you the current datetime. Look at the seconds after waiting 5 seconds between now()1 sysdate()1 with the following query (scroll to the right):

select now(),sysdate(),current_date(),sleep(5),now(),sysdate();

-- will give
-- now()    sysdate()   current_date()  sleep(5)    now()1  sysdate()1
-- 6/10/2014 2:50:04 AM 6/10/2014 2:50:04 AM    6/10/2014 12:00:00 AM   0   6/10/2014 2:50:04 AM 6/10/2014 2:50:09 AM

Need Your Help

How to insert a string containing '%' using QSqlQuery?

sqlite qt qsqlquery

I am trying to insert a string which contains '%' using QsqlQuery but I am always getting an error of type QSqlError::TransactionError with the message

Casting Map<Integer, Set<Object>>

java casting

I have a method that takes a Map&lt;Integer, Set&lt;Object&gt;&gt; as parameter. I need to call it from two different locations, using a Map&lt;Integer, Set&lt;String&gt;&gt; and a Map&lt;Integer,

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.