简体   繁体   English

如何以天为单位获得 10,000 年(最大)间隔?

[英]How to get 10,000 years (max) interval in days?

To get 10,000 years -- the max interval value -- I can use year or month :要获得 10,000 年——最大间隔值——我可以使用yearmonth

SELECT INTERVAL 10000 year, INTERVAL 10000*12 month

在此处输入图像描述

What is the value that I would use for day to get the 10,000 year value?我将使用什么值来获得 10,000 年day值? Any variation I've tried of it either does not convert-up from day to year or overflows (if I go beyond).我尝试过的任何变体要么不会逐年转换,要么会溢出(如果我超出 go 的话)。 Is there a way to convert day into year in the output, or BQ never converts it?有没有办法在 output 中将日转换为年,或者 BQ 从不转换它?

As an example:举个例子:

在此处输入图像描述

From JUSTIFY_DAYS documentation:来自JUSTIFY_DAYS文档:

Normalizes the day part of the interval to the range from -29 to 29 by incrementing/decrementing the month or year part of the interval.通过增加/减少间隔的月或年部分,将间隔的日部分标准化为-29 到 29的范围。

INTERVAL 1 MONTH is same as INTERVAL 30 DAY and therfore INTERVAL 1 YEAR will be INTERVAL 30 DAY * 12 which is INTERVAL 360 DAY . INTERVAL 1 MONTHINTERVAL 30 DAY相同,因此INTERVAL 1 YEAR将是INTERVAL 30 DAY * 12INTERVAL 360 DAY

SELECT INTERVAL 1 MONTH = INTERVAL 30 DAY month_is_30,
       INTERVAL 1 MONTH = INTERVAL 31 DAY month_is_31,
       INTERVAL 1 YEAR = INTERVAL 360 DAY year_is_360,
       INTERVAL 1 YEAR = INTERVAL 365 DAY year_is_365,

+-------------+-------------+-------------+-------------+
| month_is_30 | month_is_31 | year_is_360 | year_is_365 |
+-------------+-------------+-------------+-------------+
| true        | false       | true        | false       |
+-------------+-------------+-------------+-------------+

What is the value that I would use for day to get the 10,000 year value?我将使用什么值来获得 10,000 年的值?

SELECT INTERVAL 10000 * 360 DAY days,
       JUSTIFY_DAYS(INTERVAL 10000 * 360 DAY) max_years;
+-------------------+-----------------+
|     days          |    max_years    |
+-------------------+-----------------+
| 0-0 3600000 0:0:0 | 10000-0 0 0:0:0 |
+-------------------+-----------------+

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获得最大间隔值? - How to get max interval value? 间隔 30 天转换为间隔 4 周 2 天 - Interval 30 days getting converted to Interval 4 weeks 2 days Firestores 10 000 次写入/秒限制 - Firestores 10 000 writes/second limitation 如何在最大设置为 10 GB 的云作曲家 2 中增加工作人员存储空间 - How to increase the worker storage in cloud composer 2 which is max set to 10 GB 如何在 Firestore 查询中获取第二个 10 文档? - How to get the second 10 document in a Firestore Query? 如何获取记录中列值的最大值? (大查询) - How to get max value of column values in a record ? (BigQuery) 如何根据日期间隔获取每个 ID 和月份的最新事件列表? - How to get list of latest event per Id and month based on date interval? 对于微型程序,链接后最小的可执行文件大小现在比 2 年前大 10 倍? - Minimal executable size now 10x larger after linking than 2 years ago, for tiny programs? terraform 10天后删除桶中对象的代码 - terraform code to delete objects in the bucket after 10 days 如何在 Go 中表示 PostgreSQL 区间 - How to represent PostgreSQL interval in Go
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM