<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: Difference between datetime and timestamp in MySQL	</title>
	<atom:link href="https://www.dbrnd.com/2015/09/difference-between-datetime-and-timestamp-in-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com/2015/09/difference-between-datetime-and-timestamp-in-mysql/</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Thu, 30 May 2019 19:17:10 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>
		By: Flimm		</title>
		<link>https://www.dbrnd.com/2015/09/difference-between-datetime-and-timestamp-in-mysql/#comment-7255</link>

		<dc:creator><![CDATA[Flimm]]></dc:creator>
		<pubDate>Thu, 30 May 2019 19:17:10 +0000</pubDate>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=505#comment-7255</guid>

					<description><![CDATA[The last code example is wrong. If you update a row to change the `ID` column, the other columns have no reason to change unless the columns were defined with an &quot;ON UPDATE...&quot; clause, which they weren&#039;t. Please try running the queries and see for yourself.]]></description>
			<content:encoded><![CDATA[<p>The last code example is wrong. If you update a row to change the <code>ID</code> column, the other columns have no reason to change unless the columns were defined with an &#8220;ON UPDATE&#8230;&#8221; clause, which they weren&#8217;t. Please try running the queries and see for yourself.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: iceage		</title>
		<link>https://www.dbrnd.com/2015/09/difference-between-datetime-and-timestamp-in-mysql/#comment-4729</link>

		<dc:creator><![CDATA[iceage]]></dc:creator>
		<pubDate>Thu, 05 May 2016 01:58:14 +0000</pubDate>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=505#comment-4729</guid>

					<description><![CDATA[TIMESTAMP used to track changes to records, and update every time when the record is changed，
&#039;timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP&#039; make it;

select version();
+------------+
&#124; version()  &#124;
+------------+
&#124; 5.6.28-log &#124;
+------------+

09:46:02 scott&#062; create table t1 (id int,dt datetime,ts timestamp);
Query OK, 0 rows affected (0.01 sec)

09:46:31 scott&#062; insert into t1 values (1,now(),now());
Query OK, 1 row affected (0.01 sec)

09:46:47 scott&#062; select * from t1;
+------+---------------------+---------------------+
&#124; id   &#124; dt                  &#124; ts                  &#124;
+------+---------------------+---------------------+
&#124;    1 &#124; 2016-05-05 09:46:47 &#124; 2016-05-05 09:46:47 &#124;
+------+---------------------+---------------------+
1 row in set (0.00 sec)

09:46:54 scott&#062; update t1 set id=2;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

09:47:03 scott&#062; select * from t1;
+------+---------------------+---------------------+
&#124; id   &#124; dt                  &#124; ts                  &#124;
+------+---------------------+---------------------+
&#124;    2 &#124; 2016-05-05 09:46:47 &#124; 2016-05-05 09:47:03 &#124;
+------+---------------------+---------------------+
1 row in set (0.00 sec)

09:47:05 scott&#062; show create table t1;
+-------+--------------------------------------------------------------------------------------+
&#124; Table &#124; Create Table                                                                         &#124;
+-------+--------------------------------------------------------------------------------------+
&#124; t1    &#124; CREATE TABLE `t1` (
  `id` int(11) DEFAULT NULL,
  `dt` datetime DEFAULT NULL,
  `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=gbk &#124;
+-------+--------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

09:48:07 scott&#062; create table t2 (id int,dt datetime,ts timestamp null);
Query OK, 0 rows affected (0.01 sec)

09:48:45 scott&#062; show create table t2;
+-------+-------------------------------------------------------------------------------------+
&#124; Table &#124; Create Table                                                                        &#124;
+-------+-------------------------------------------------------------------------------------+
&#124; t2    &#124; CREATE TABLE `t2` (
  `id` int(11) DEFAULT NULL,
  `dt` datetime DEFAULT NULL,
  `ts` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=gbk &#124;
+-------+-------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

09:48:52 scott&#062; insert into t2 values (1,now(),now());
Query OK, 1 row affected (0.00 sec)

09:49:05 scott&#062; select * from t2;
+------+---------------------+---------------------+
&#124; id   &#124; dt                  &#124; ts                  &#124;
+------+---------------------+---------------------+
&#124;    1 &#124; 2016-05-05 09:49:05 &#124; 2016-05-05 09:49:05 &#124;
+------+---------------------+---------------------+
1 row in set (0.00 sec)

09:49:11 scott&#062; update t2 set id=2;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

09:49:19 scott&#062; select * from t2;
+------+---------------------+---------------------+
&#124; id   &#124; dt                  &#124; ts                  &#124;
+------+---------------------+---------------------+
&#124;    2 &#124; 2016-05-05 09:49:05 &#124; 2016-05-05 09:49:05 &#124;
+------+---------------------+---------------------+]]></description>
			<content:encoded><![CDATA[<p>TIMESTAMP used to track changes to records, and update every time when the record is changed，<br />
&#8216;timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP&#8217; make it;</p>
<p>select version();<br />
+&#8212;&#8212;&#8212;&#8212;+<br />
| version()  |<br />
+&#8212;&#8212;&#8212;&#8212;+<br />
| 5.6.28-log |<br />
+&#8212;&#8212;&#8212;&#8212;+</p>
<p>09:46:02 scott&gt; create table t1 (id int,dt datetime,ts timestamp);<br />
Query OK, 0 rows affected (0.01 sec)</p>
<p>09:46:31 scott&gt; insert into t1 values (1,now(),now());<br />
Query OK, 1 row affected (0.01 sec)</p>
<p>09:46:47 scott&gt; select * from t1;<br />
+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| id   | dt                  | ts                  |<br />
+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
|    1 | 2016-05-05 09:46:47 | 2016-05-05 09:46:47 |<br />
+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
1 row in set (0.00 sec)</p>
<p>09:46:54 scott&gt; update t1 set id=2;<br />
Query OK, 1 row affected (0.00 sec)<br />
Rows matched: 1  Changed: 1  Warnings: 0</p>
<p>09:47:03 scott&gt; select * from t1;<br />
+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| id   | dt                  | ts                  |<br />
+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
|    2 | 2016-05-05 09:46:47 | 2016-05-05 09:47:03 |<br />
+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
1 row in set (0.00 sec)</p>
<p>09:47:05 scott&gt; show create table t1;<br />
+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
| Table | Create Table                                                                         |<br />
+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
| t1    | CREATE TABLE <code>t1</code> (<br />
  <code>id</code> int(11) DEFAULT NULL,<br />
  <code>dt</code> datetime DEFAULT NULL,<br />
  <code>ts</code> timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP<br />
) ENGINE=InnoDB DEFAULT CHARSET=gbk |<br />
+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
1 row in set (0.00 sec)</p>
<p>09:48:07 scott&gt; create table t2 (id int,dt datetime,ts timestamp null);<br />
Query OK, 0 rows affected (0.01 sec)</p>
<p>09:48:45 scott&gt; show create table t2;<br />
+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| Table | Create Table                                                                        |<br />
+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
| t2    | CREATE TABLE <code>t2</code> (<br />
  <code>id</code> int(11) DEFAULT NULL,<br />
  <code>dt</code> datetime DEFAULT NULL,<br />
  <code>ts</code> timestamp NULL DEFAULT NULL<br />
) ENGINE=InnoDB DEFAULT CHARSET=gbk |<br />
+&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br />
1 row in set (0.00 sec)</p>
<p>09:48:52 scott&gt; insert into t2 values (1,now(),now());<br />
Query OK, 1 row affected (0.00 sec)</p>
<p>09:49:05 scott&gt; select * from t2;<br />
+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| id   | dt                  | ts                  |<br />
+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
|    1 | 2016-05-05 09:49:05 | 2016-05-05 09:49:05 |<br />
+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
1 row in set (0.00 sec)</p>
<p>09:49:11 scott&gt; update t2 set id=2;<br />
Query OK, 1 row affected (0.00 sec)<br />
Rows matched: 1  Changed: 1  Warnings: 0</p>
<p>09:49:19 scott&gt; select * from t2;<br />
+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| id   | dt                  | ts                  |<br />
+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
|    2 | 2016-05-05 09:49:05 | 2016-05-05 09:49:05 |<br />
+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Anvesh Patel		</title>
		<link>https://www.dbrnd.com/2015/09/difference-between-datetime-and-timestamp-in-mysql/#comment-427</link>

		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 27 Nov 2015 04:37:07 +0000</pubDate>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=505#comment-427</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.dbrnd.com/2015/09/difference-between-datetime-and-timestamp-in-mysql/#comment-426&quot;&gt;Monika&lt;/a&gt;.

Thanks Monika for such a nice comment ! 
For any queries you can direct contact me at anvesh@dbrnd.com]]></description>
			<content:encoded><![CDATA[<p>Thanks Monika for such a nice comment !<br />
For any queries you can direct contact me at <a href="mailto:anvesh@dbrnd.com">anvesh@dbrnd.com</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Monika		</title>
		<link>https://www.dbrnd.com/2015/09/difference-between-datetime-and-timestamp-in-mysql/#comment-426</link>

		<dc:creator><![CDATA[Monika]]></dc:creator>
		<pubDate>Fri, 27 Nov 2015 02:04:45 +0000</pubDate>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=505#comment-426</guid>

					<description><![CDATA[Nice post !. Guys I am telling you, Anvesh is one of the next big person in Database Technology. He has just started blog and very popular in couple of months. Anvesh I can see your future after 3 to 4 year, you will be next to Pinal Dave(SQL Server Specialist). 
I am also Senior Database Architecture.
Thanks for the help !
]]></description>
			<content:encoded><![CDATA[<p>Nice post !. Guys I am telling you, Anvesh is one of the next big person in Database Technology. He has just started blog and very popular in couple of months. Anvesh I can see your future after 3 to 4 year, you will be next to Pinal Dave(SQL Server Specialist).<br />
I am also Senior Database Architecture.<br />
Thanks for the help !</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
