准备数据
create table if not exists tmp_table_friends
(
name string comment '名字',
appearance double comment '外貌',
character double comment '性格',
ability double comment '能力',
humor double comment '幽默',
job double comment '工作',
figure double comment '外形',
family double comment '家庭'
);
insert into tmp_table_friends
(name,appearance,character,ability,humor,job,figure,family)
values
('Elizabeth',90,89,70,78,69,60,70),
('Bella',99,80,60,65,60,80,70),
('Melody',60,90,90,80,88,65,89),
('CC',92,80,66,69,70,89,80),
('Lili',90,80,80,60,70,80,60);
select * from tmp_table_friends ;
将多列转为一列,一行转为多行,并输出top3的特征;
select dist