Home > Database > Mysql Tutorial > Vertica用于时间计算的SQL语句大全

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

WBOY
Release: 2016-06-07 15:56:53
Original
2135 people have browsed it

三个字:强、大、全,强力推荐之 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'); 
Copy after login
16 10:10
Copy after login
select (timestamp '2005-01-17 10:00' - timestamp '2005-01-01') / 7; 
Copy after login
2 08:17:08.571429
Copy after login
select (timestamp '2005-01-17 10:00' - timestamp '2005-01-01') day; 
Copy after login
16
Copy after login
select cast((timestamp '2005-01-17 10:00' - timestamp '2005-01-01') day as integer) / 7; 
Copy after login
2
Copy after login
Copy after login
Copy after login
select floor((timestamp '2005-01-17 10:00' - timestamp '2005-01-01') / interval '7'); 
Copy after login
2
Copy after login
Copy after login
Copy after login
select timestamptz '2009-05-29 15:21:00.456789';
Copy after login
2009-05-2915:21:00.456789-04
Copy after login
select timestamptz '2009-05-28';
Copy after login
2009-05-2800:00:00-04
Copy after login
select timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28';
Copy after login
1 15:21:00.456789
Copy after login
Copy after login
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28');
Copy after login
1 15:21:00.456789
Copy after login
Copy after login
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28')(3);
Copy after login
1 15:21:00.457
Copy after login
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28')second;
Copy after login
141660.456789
Copy after login
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28') year;
Copy after login
0
Copy after login
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2007-01-01') month;
Copy after login
28
Copy after login
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2007-01-01') year;
Copy after login
2
Copy after login
Copy after login
Copy after login
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2007-01-01') year to month;
Copy after login
2-4
Copy after login
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28') second(3);
Copy after login
141660.457
Copy after login
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28') minute(3);
Copy after login
2361
Copy after login
Copy after login
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28') minute;
Copy after login
2361
Copy after login
Copy after login
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28') minute to second(3);
Copy after login
2361:00.457
Copy after login
select (timestamptz '2009-05-29 15:21:00.456789'-timestamptz '2009-05-28') minute to second;
Copy after login
2361:00.456789
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template