The date data is basically dated, with VARCHAR2 or char, the benefits are as follows:
1, data specification. Date is validated for the legal date type, including leap year February. Avoid the problem that the character type variable produces a month number 32nd, the date length is not correct, the date format is not uniform and so on. There has been a painful experience, the face of the character type of 2013111 this data do not know whether it is November 1 or January 11, just want to say th ...
2, retrieval efficiency. If you often take this date behind the where, or you want to Jianjian the word index. You can try the difference between date and char, let alone partition index.
3, convenient calculation. When you calculate the two date difference days, you are willing to write a function of char to Judge Otsuki Yue Leap month, or directly take the date variable date1-date2 it? Do you want to write a large section of the stored procedure, or update the table set DATE1=DATE1+50 directly when you are going to defer the date in bulk for 50 days?
If the date variable is a char (14), it is not worth being created alone, and since it exists, it must have special meaning and use value.
Wet Dreams's Bride
Links: https://www.zhihu.com/question/25541686/answer/31068450
Source: Know
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
Database storage time data with timestamp good or varchar good