MySQL data storage method millisecond new to MySQL considerable portion of my friends have experienced this same question, is stored on the display milliseconds. Because MySQL data type provides only a DATETIME, TIMESTAMP, T

  There are a considerable number of new to MySQL friends have experienced this same question, is stored on the display milliseconds. Because MySQL data type provides only DATETIME, TIMESTAMP, TIME, DATE, YEAR which several types of time, and the minimum unit DATETIME and TIMESTAMP seconds, milliseconds no storage function. However, MySQL was able to identify the part of the time in milliseconds. And we have several ways to get millisecond part of such functions: microsecond and so on.

  I am here to give a simple example, to store part of the seconds before and after.

  For the application of the primary key field as time, we can establish the following conversion table to accordingly:

  

 

  

 

  

 

  

 

  

 

  Or is VARCHAR to store all the time fields, or is stored in a HASH to ensure the performance!

  Many ways, to see how your application with the reasonable.

Guess you like

Origin blog.csdn.net/qianfeng_dashuju/article/details/93746625