-- DATA(三个字节1000-1-01-01~9999-12-31),YYYY-MM-DD
-- TIME,()HH:MM:SS
-- YEAR,(1901-2155)YYYY
-- DATETIME,(1000-1-01-01~9999-12-31)YYYY-MM-DD HH:MM:SS 还可以继续向下精确
-- TIMRSTAMP(1970-01-01~2037-xx-xx)YYYY-MM-DD HH:MM:SS
--
create table tabledate (birthday date);
select * from tabledate;
insert into tabledate values('2018-06-28',20150201,20150201);
-- 插入格式多样(非字符串格式)
alter table tabledate add datetimecol datetime;
alter table tabledate add datetimecol2 datetime(2);
-- 括号带数字表示精确度,表示秒还可以继续向下面增加
alter table tabledate add time1 timestamp;-- now时间
alter table tabledate add time2 timestamp;-- 00:00:00时间
alter table tabledate drop time1;
alter table tabledate drop time2;
-- TIME,()HH:MM:SS
-- YEAR,(1901-2155)YYYY
-- DATETIME,(1000-1-01-01~9999-12-31)YYYY-MM-DD HH:MM:SS 还可以继续向下精确
-- TIMRSTAMP(1970-01-01~2037-xx-xx)YYYY-MM-DD HH:MM:SS
--
create table tabledate (birthday date);
select * from tabledate;
insert into tabledate values('2018-06-28',20150201,20150201);
-- 插入格式多样(非字符串格式)
alter table tabledate add datetimecol datetime;
alter table tabledate add datetimecol2 datetime(2);
-- 括号带数字表示精确度,表示秒还可以继续向下面增加
alter table tabledate add time1 timestamp;-- now时间
alter table tabledate add time2 timestamp;-- 00:00:00时间
alter table tabledate drop time1;
alter table tabledate drop time2;