Lesson 6 small notes can MySQL

Date / Time Type:

 

Date type date type, storage date. Build a schedule, store Li Xiaoxin classmate's birthday.

create table test4( stat varchar(20) not null default '', birth date not null default '0000-00-00')engine myisam charset utf8;

 

 

Time Type: time, such as daily attendance record check time

 

 

Date Time Type: datetime Date Time Type Input Format yyyy-mm-dd HH: ii: ss

Such as event registration. // here just to practice, really accurate to the second, with a time stamp record.

create table test5( sanme varchar(20) not null default '', logintime datetime not null default '0000-00-00 00:00:00' )engine myisam charset utf8;

 

Timestamp a more interesting column indicates the current takeout time.

create table test7(

    -> ts timestamp default CURRENT_TIMESTAMP

    -> id,int

    -> )engine myisam charset utf8;

 

Type: year only one byte, store up to 256 variations

 

 

year type can also be abbreviated to two, so is not recommended for use

 

 

Published 33 original articles · won praise 4 · Views 3251

Guess you like

Origin blog.csdn.net/linux2422988311/article/details/104224973