建表student:
create table student(
id varchar(100),
name varchar(100),
age varchar(100)
);
插入数据:
insert into student values('1','a','10');
insert into student values('2','b','20');
insert into student values('3','c','30');
此刻查询表:
select * from student;
多行转单列,建新表student1:
create table student1 as
select id from student
union all
select name from student
union all
select age from student;
查询新表:
select * from student1;
得到: