MySQL 时间

1.去掉重复的数值

select owner from pet;

select distinct owner from pet;

 

2.

CREATE TABLE t1 (year YEAR(4), month INT(2) UNSIGNED ZEROFILL,
    day INT(2) UNSIGNED ZEROFILL);
INSERT INTO t1 VALUES(2000,1,1),(2000,1,20),(2000,1,30),(2000,2,2),
    (2000,2,23),(2000,2,23);

year(4)

insert into time values(78);   #数据库中显示:1978
insert into time values('78'); #数据库中显示:1978
insert into time values('1978'); #数据库中显示:1978

UNSIGNED:

将数字类型无符号化,这与C和C++这些程序语言的unsigned含义相同。

INT的类型范围-2 147 483 648~2 147 483 647

INT UNSIGNED范围0~4 294 967 295

 

posted @ 2017-08-06 11:37  小小宇小小灰  阅读(111)  评论(0编辑  收藏  举报