【发布时间】:2021-03-23 16:24:43
【问题描述】:
我有表 A,其中包含存储为时间戳数据类型的列 time。
表 A:包含 24 小时格式的 HH:MM:SS 时间列。
Sample data below:
time
12:32:45
16:09:04
09:02:16
18:34:33
08:59:30
Now I want to create a bucket based on hours and adding AM/PM.
eg:
time between 00:00:00 - 00:59:00 = 12 AM,
01:00:00 - 01:59:00 = 01 AM,
14:00:00 - 14:59:00 = 02 PM and so on.
Desired Output :
time new_time
12:32:45 12 PM
16:09:04 04 PM
09:02:16 09 AM
18:34:33 06 PM
08:59:30 08 AM
【问题讨论】:
-
标记您的数据库,解决方案可能依赖于 RDBMS
-
@Stu 这是 Cloudera,脚本是 HUE-Impala。类似于 SQL
标签: sql time hiveql cloudera impala