当前位置:网站首页>UNION ALL UNION FULL JOIN

UNION ALL UNION FULL JOIN

2022-06-24 19:42:00 程序员久安

– create table aaa.student(xh VARCHAR(255),xm varchar(255),nl VARCHAR(255));
– insert into student values(1,‘A’,21);
– insert into student values(2,‘B’,21);
– insert into student values(3,‘A’,21);
– insert into student values(4,‘A’,21);
– insert into student values(5,‘A’,21);
– insert into student values(6,‘C’,21);
– insert into student values(7,‘B’,21);

– select * from student
– union
– select * from student where xm=‘A’;

– select * from student
– union all
– select * from student where xm=‘A’;

– full join
select * from student as a LEFT JOIN student as b on a.xh = b.xh
union all
select * from student as a RIGHT JOIN student as b on a.xh = b.xh

原网站

版权声明
本文为[程序员久安]所创,转载请带上原文链接,感谢
https://withk.blog.csdn.net/article/details/124981456