Vertica用于时间计算的SQL语句大全

WBOY
發布: 2016-06-07 15:56:53
原創
2111 人瀏覽過

三个字:强、大、全,强力推荐之 SQL语句 查询结果 select (timestamp 2005-01-17 10:00 - timestamp 2005-01-01); 16 10:10 select (timestamp 2005-01-17 10:00 - timestamp 2005-01-01) / 7; 2 08:17:08.571429 select (timestamp 2005-01-17 10:00 - tim

三个字:强、大、全,强力推荐之

SQL语句 查询结果
select (timestamp '2005-01-17 10:00' - timestamp '2005-01-01'); 
登入後複製
16 10:10
登入後複製
select (timestamp '2005-01-17 10:00' - timestamp '2005-01-01') / 7; 
登入後複製
2 08:17:08.571429
登入後複製
select (timestamp '2005-01-17 10:00' - timestamp '2005-01-01') day; 
登入後複製
16
登入後複製
select cast((timestamp '2005-01-17 10:00' - timestamp '2005-01-01') day as integer) / 7; 
登入後複製
2
登入後複製
登入後複製
登入後複製
select floor((timestamp '2005-01-17 10:00' - timestamp '2005-01-01') / interval '7'); 
登入後複製
2
登入後複製
登入後複製
登入後複製
select timestamptz '2009-05-29 15:21:00.456789';
登入後複製
2009-05-2915:21:00.456789-04
登入後複製
select timestamptz '2009-05-28';
登入後複製
2009-05-2800:00:00-04
登入後複製
select timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28';
登入後複製
1 15:21:00.456789
登入後複製
登入後複製
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28');
登入後複製
1 15:21:00.456789
登入後複製
登入後複製
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28')(3);
登入後複製
1 15:21:00.457
登入後複製
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28')second;
登入後複製
141660.456789
登入後複製
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28') year;
登入後複製
0
登入後複製
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2007-01-01') month;
登入後複製
28
登入後複製
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2007-01-01') year;
登入後複製
2
登入後複製
登入後複製
登入後複製
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2007-01-01') year to month;
登入後複製
2-4
登入後複製
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28') second(3);
登入後複製
141660.457
登入後複製
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28') minute(3);
登入後複製
2361
登入後複製
登入後複製
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28') minute;
登入後複製
2361
登入後複製
登入後複製
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28') minute to second(3);
登入後複製
2361:00.457
登入後複製
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28') minute to second;
登入後複製
2361:00.456789
登入後複製

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板