Difference between TIMESTAMP DEFAULT, CURRENT_TIMESTAMP, ON UPDATE CURRENT_TIMESTAMP in MYSQL

Difference between TIMESTAMP DEFAULT, CURRENT_TIMESTAMP, ON UPDATE CURRENT_TIMESTAMP in MYSQL

TIMESTAMP DEFAULT :- in this when new row get inserted or existing row get updated that time current timestamp get inserted.

CURRENT_TIMESTAMP :- in this when row get inserted that time current timestamp get inserted.no change on update.

ON UPDATE CURRENT_TIMESTAMP :- when row get affected that time current timestamp get inserted.

Regards

Prasanna Shejwal

Similar Posts:

2 Replies to “Difference between TIMESTAMP DEFAULT, CURRENT_TIMESTAMP, ON UPDATE CURRENT_TIMESTAMP in MYSQL”

  1. Hi Prasanna, your blog is informative but the grammar can improve. I did not understand the diff between all these mysqls because of unclear language.

  2. Hi Prasanna,
    i hava problam while updating a field in a table and in that Date field which is TIMSTAMP dayatype also updating.
    This Date field default value is CURRENT_TIMESTAMP .
    I am using this query : “UPDATE cheque_dd_details SET InvoiceNo=? Where UserID=? AND PaidTo=? AND ServiceBuyDate=? AND InvoiceNo IS NULL” ,
    in this ServiceBuyDate fiels is TIMESTAMP data type

Leave a Reply

Your email address will not be published.