MySQL does not support the Default of the row to be the form of function at present, if achieve you,some acquiescent value is the function that updates date and time currently, you can use TIMESTAMP to list a kind
Define below TIMESTAMP lists a kind: ?
TIMESTAMP lists a kind
TIMESTAMP value is OK from of 1970 some time begin to arrive all the time 2037, precision is one second, its are worth amount to word to show.
TIMESTAMP value shows the format of dimension expresses place to show as follows:
--------------- ----------------
| List of type | Indication format |
| TIMESTAMP(14) | YYYYMMDDHHMMSS |
| TIMESTAMP(12) | YYMMDDHHMMSS |
| TIMESTAMP(10) | YYMMDDHHMM |
| TIMESTAMP(8) | YYYYMMDD |
| TIMESTAMP(6) | YYMMDD |
| TIMESTAMP(4) | of YYMM |
| TIMESTAMP(2) | of of YY |
--------------- ----------------
Format of “ complete ”TIMESTAMP is 14, but TIMESTAMP row also can use shorter indication dimension creation
The commonnest indication measure is 6, 8, 12, with 14.
You can specify an aleatoric indication size when founding a watch, but definition list is long for 0 or than 14 all can be enforced to define greatly grow for the row 14.
The list is long in from 1 ~ the strange numeric dimension of 13 limits all is enforced to be the even number with larger the next.
Definition word end length spends compulsive field length
TIMESTAMP(14 of TIMESTAMP(0) -> )
TIMESTAMP(15)-> TIMESTAMP(14)
TIMESTAMP(2 of TIMESTAMP(1) -> )
of TIMESTAMP(6) of TIMESTAMP(5) ->
All TIMESTAMP rows have similar memory volume,
The complete precision that uses the period time value that is assigned (14) the value with lawful memory takes no account of indication dimension.
Illegimate date, will be enforced to be 0 memory
This has a few implication:
1, although you are built,row TIMESTAMP(8) was defined when the watch, but the data that undertakes in you with the TIMESTAMP when updating the row saved 14 actually counting occupying insertion (include date time second) , what just return you in the MySQL when you undertake inquiring is 8 date data. If you use ALTER TABLE to widen a narrow TIMESTAMP is listed, be concealmented by “ previously the information of ” will be shown.
2, same, narrow row of a TIMESTAMP won't bring about information to lose, when showing besides the value on the feeling, less information is shown.
3, although TIMESTAMP value is stored be complete precision, direct operation stores the sole function of the value is Unix_TIMESTAMP() ; Because MySQL returns the line that TIMESTAMP arranges,the value is the cost that has taken the retrieval after the format is changed, this means you to cannot use certain function possibly to operate TIMESTAMP to list (for example HOUR() or SECOND() ) , unless the relevant section of TIMESTAMP value is included,be in formatted value. For example, when row of a TIMESTAMP is defined to be TIMESTAMP(10) above only, the HH share that TIMESTAMP lists just can be shown, because this is in,shorter TIMESTAMP uses HOUR() to be able to produce an unpredictable result on the value.
Previous12 3 4 Next
Hot Tags: