kingbase时间类型

1.创建时间类型的表

create table test_date(c1 date,c2 timestamp,c3 timestamp with time zone,c4 timestamp with local time zone,c5 interval year to month,c6 interval day to second);

--2.插入数据

 insert into test_date values(date('2022-03-21'),now(),clock_timestamp()::timestamp(0) with time zone,clock_timestamp()::timestamp(0) with local time zone,'22-03','21 12:11:22');

--3.查询

select * from test_date;

Drop table test_date;

--4.interval数据类型

SELECT interval '3 days';

SELECT interval '1 year 2 mons';

SELECT interval '1-2' year to month;

SELECT interval '14' month;

select interval '2 34:23:11.1234' day to second(3);

你可能感兴趣的:(数据库,sql,mysql)