473,785 Members | 2,573 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Order of the columns (timestamp) in create statement makes a difference

The first timestamp will always be "automatica lly generated time." So if
the record is updated, or inserted, this time gets changed. However, if the
column order is changed with an alter statement, this is no longer the case.

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

Note above Update and timeEnter, although both are defined as timestamp,
operate differently.
Reference (See TIP 3):
http://unc.dl.sourceforge.net/source...ADME_mysql.txt

I hope this helps...it threw me for a loop the first time.

If you have an interesting TIP can you send it to me or post it? I'll add
to the list to benefit everyone.

Regards,

Mike Chirico
Jul 20 '05 #1
1 1342

"Mike Chirico" <mc******@comca st.net> skrev i en meddelelse
news:JY******** ************@co mcast.com...
The first timestamp will always be "automatica lly generated time." So if
the record is updated, or inserted, this time gets changed. However, if the column order is changed with an alter statement, this is no longer the case.
create table t (
a int,
b int,
timeUpdate timestamp,
timeEnter timestamp );

Note above Update and timeEnter, although both are defined as timestamp,
operate differently.


To avoid confusion, only use one timestamp, make the rest datetime

Leif
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3671
by: svilen | last post by:
hello again. i'm now into using python instead of another language(s) for describing structures of data, including names, structure, type-checks, conversions, value-validations, metadata etc. And i have things to offer, and to request. And a lot of ideas, but who needs them.... here's an example (from type_struct.py):
1
2430
by: MultiTaskinG | last post by:
I want to retrieve all comment stored from my web users ordered BY THREAD and BY TIMESTAMP (INT 11) with a single query (if is possible) now I launch this query: SELECT thread, timestamp, level FROM comments WHERE articleid=16 ORDER BY thread, timestamp,level
6
5116
by: alederer | last post by:
Hallo! I have a table tstest(ts char(13) for bit data constraint a unique). This column is filled in a trigger with generate_unique(). In a application (CLI), I have the values of this column as timestamp representation: e.g.: select timestamp(ts) from tstest 1
0
1888
by: phil campaigne | last post by:
Hi I'm trying to create a select statement that will return all rows that are older than 30 milleseconds. Is either of these correct? select event_id from event where (current_timestamp-timestamp)>.030 or select event_id from event where (current_timestamp-timestamp)>000000030.000000 thanks, Phil
29
27609
by: pb648174 | last post by:
I have the following basic statements being executed: Create a temp table, #TempPaging Insert Into #TempPaging (Col1, Col2) Select Col1, Col2 From SomeOtherTable Order By Col2, Col1 Select * from #TempPaging I can't provide a reproduceable scenario right now without making this
3
3666
by: Beowulf | last post by:
I was just messing around with some ad hoc views and table returning UDFs today so I could look at and print out data from a small table and noticed something strange. If I stick my select statement into a View the columns are returned in the order I specify in the SELECT, but if the same statement is in a UDF (so I can specify a parameter), the columns are not returned in the order specified in statement. I know that relations don't...
3
1378
crabpot8
by: crabpot8 | last post by:
I am decent at queries, but recently i made a new DB with about 50000+ entries. Queries are taking almost 20+ seconds, and i think it is that i dont have decently structured keys - this is the first time I was the one that created the DB structure. Here is the info that seemed relevant - ANY HELP APPRECIATED There is one 'primary' key - a mix of server, timestamp, and ipaddress This is a few server access logs put into a database Also -...
0
3035
by: Frank Swarbrick | last post by:
So we're trying to decide if it's better to use IDENTITY columns or sequences to create a surrogate key as the primary key for our tables. I kind of like the identity column, because it's more 'tightly integrated' in to the table. With a sequence you have to make sure that each application that inserts records uses the same sequence. (Probably not likely that it wouldn't, but...) One thing where it seems like a SEQUENCE would be...
5
4841
by: Henry J. | last post by:
I know this could be a dumb question, I just want to confirm that it is faster to execute inserts, if a timestamp field is set to have a default value, like DEFAULT CURRENT TIMESTAMP, and skip that column in inserts, than to include explicit timestamps in the inserts and let the DB insert them. Thanks!
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9485
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10161
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9958
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7506
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5523
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.