GBase 8s
其他
问答
默认添加timestamp字段
发表于2023-08-08 10:08:00486次浏览3个评论
为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【GBase版本】:8s
【操作系统】:centos7
【CPU】:
【问题描述】*:GBase 8S timestamp字段默认添加当前时间加上时分秒(如:2023-8-8 10:00:00)默认值关键字或者表达式是什么
热门帖子
- 12025-12-01浏览数:182759
- 22023-05-09浏览数:25052
- 42023-09-25浏览数:18521
- 52020-05-11浏览数:17526
timestamp表示datetime year to second;
timestamp(N) (1<=N<=6)表示datetime year to fraction(N) (1<=N<=5),特别说明:timestamp(6)实际将转换成datetime year to fraction(5)。
示例
创建表
create table tab_ts
(
col1 timestamp,
col2 timestamp(3),
col3 timestamp(5),
col4 timestamp(6)
);
insert into tab_ts values(
current year to fraction(5),
current year to fraction(5),
current year to fraction(5),
current year to fraction(5)
);
查询数据
select * from tab_ts;
结果
col1 2022-04-13 14:49:34
col2 2022-04-13 14:49:34.000
col3 2022-04-13 14:49:34.00000
col4 2022-04-13 14:49:34.00000