Database Add Time Type

Source: Internet
Author: User
Tags add time

Date Type:

DateTime date hour minute seconds format must be

' Yyyy-mm-dd hh:mm:ss '

Timestamp type:

What is a timestamp, is a date, if you have the year, month, day, hour, minute, second, is the timestamp.

Change the type of T1 table to timestamp

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/84/03/wKiom1eDS3jAqL3zAAA7-caunXM855.png-wh_500x0-wm_3 -wmp_4-s_3758443200.png "title=" 1.png "alt=" Wkiom1eds3jaql3zaaa7-caunxm855.png-wh_50 "/>

Value range: 1970 1 1 00:00:00 But we're in the East 8, so when we test, the minimum time to add is "1970-1-108:00:01"

Date type: Only month day

Time type: only seconds and minutes

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/84/03/wKiom1eDS4WAVM7-AAA7Dbt_7ww194.png-wh_500x0-wm_3 -wmp_4-s_3548160294.png "title=" 2.png "alt=" Wkiom1eds4wavm7-aaa7dbt_7ww194.png-wh_50 "/>

Year type, can only be stored for years:

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/84/03/wKiom1eDS5DRrpq7AAA--7ruyIU393.png-wh_500x0-wm_3 -wmp_4-s_2720855044.png "title=" 3.png "alt=" Wkiom1eds5drrpq7aaa--7ruyiu393.png-wh_50 "/>

Places to note about dates:

1. In the database, the date plus the number, the number

2. In the database, numbers + numbers, numbers

3. In the database, numbers + strings, numbers

4. In the database, the string + string, the number, at this time if the string can not become a number, as far as possible to become a number;

String type:

The char string type char (n) indicates that the string holds a maximum of n bytes.

VarChar is also a string type, and varchar (n) is also a means of storing up to n bytes. This effect, like char, they are always a little different!

Char is a fixed length

VARCHAR is a variable length

Like what:

char (10) type, if 1 ' a ' is stored, it is stored in this way

' A ', make up 10 characters, fill the left blank

Varchar (10) type, if 1 ' a ' is stored, it is stored in this way

' A ', without filling 10 characters, left without space

It looks like varchar saves space and char wastes space. Often using varchar, char, although a waste of space, but the storage efficiency is high, although varchar save space, but varchar will be redundant column deleted, more This step, reduce efficiency.

CHAR (11) is most suitable when we store the phone!

Char (n) where n is the maximum value of 255.

varchar (n) where n is the maximum value of 65535, however, in this 65,535 byte, there are two bytes to hold the information of the Varchar column itself. There are 65,533 remaining, and 1 bytes to hold the null value. There's 65532left.

In a simple sentence, the N maximum value in varchar (n) is 65532.

When a varchar or char represents a maximum byte that is already unable to meet the business requirements, for example, a kingdoms novel is stored in the database, is it possible for a varchar (max) char to solve it?

So there is this type: text, 2g is actually a kind of varchar, but the type of byte that can be stored in the range of 2g.

Tinytext Mediumtext Text Longtext

Enumeration type: Enumeration, say the end, you know the tail, meaning the value can be enumerated type.

For example: Week. Zodiac. Constellation.  Gender.  Degree. These are enumerated types.

Enumeration type is an enum in MySQL.

Ido (Shenzhen) Media Co., Ltd.

Look at the new angle of the world

: Edoyojoy

Micro-Blog: Http://weibo.com/EDOYOJOY

Official website: http://www.edovis.com/

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/84/03/wKiom1eDTG-wSjPPAARiY5244a8346.jpg "title=" Ease of Psd.jpg "alt=" Wkiom1edtg-wsjppaariy5244a8346.jpg "/>



Database Add Time Type

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.