ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[TOC] # 行转列 创建表 ~~~ hive (db1)> create table person_info( > name string, > constellation string, > blood_type string) > row format delimited fields terminated by "\t"; ~~~ 数据 ~~~ 孙悟空 白羊座 A 大海 射手座 A 康师傅 白羊座 B 猪八戒 白羊座 A 凤姐 射手座 A ~~~ 导入数据 ~~~ load data local inpath "/root/study/person_info.tsv" into table person_info; ~~~ sql ~~~ select t1.base, concat_ws('|', collect_set(t1.name)) name from ( select name, concat(constellation, ",", blood_type) base from person_info ) t1 group by t1.base; ~~~