列:hp(数值)
、power_rate(空/NULL)
。
if hp>70
power_rate column should be populated as 'powerful'
else
power_rate should be 'moderate'
如何使用 Hive 实现此目的?
最佳答案
使用case
语句:
insert overwrite table
select hp, case when hp>70 then 'powerful' else 'moderate' end as power_rate
from table
关于sql - 在 Hive 中使用带有 if 条件的 select 语句来填充另一列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51076998/