Septanet Forum  

Go Back   Septanet Forum > Computers, Software, Harware, Information Technology > MySQL

Reply
 
LinkBack Thread Tools Display Modes
Old 05-08-2011, 03:31 PM   #1
Senior Member
 
kaman's Avatar
 
Join Date: Aug 2011
Posts: 111
Smile Can the order of the columns in a create statement make a difference?

YES, it does. Please read below mentioned example and explanation.

create table t (
a int,
b int,
timeUpdate timestamp,
timeEnter timestamp );

The first timestamp will always be the "automatically generated" time. So if the record is updated, or inserted, this time gets changed. If the order is changed, "timeEnter" is before "timeUpdate", then, "timeEnter" would get updated. First timestamp column updates automatically.

Note, in the table above timeEnter will only get updated if passed a null value.

insert into t (a,b,timeEnter) values (1,2,NULL);

Thank You for reading. Your valuable feedback are always appreciated.
kaman is offline  
Digg this Post!Bookmark Post in Technorati
Reply With Quote
Old 20-08-2011, 02:02 PM   #2
Senior Member
 
sharma.s.prakash's Avatar
 
Join Date: Aug 2011
Posts: 110
Default

nice information !!!!
sharma.s.prakash is offline  
Digg this Post!Bookmark Post in Technorati
Reply With Quote
Reply

Tags
columns order, mysql tips

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +5.5. The time now is 12:39 PM.


Content Relevant URLs by vBSEO 3.5.0 RC2