Javaweb-连接查询-内连接和外连接


select emp.name,emp.gender,dept.dname from emp,dept where emp.dep_id=dept.did;
select t1.name,t1.gender,t2.dname from emp t1,dept t2 where t1.dep_id=t2.did; -- 为了防止表名过长,还可以给表取别名





select * from emp INNER JOIN dept on emp.dep_id=dept.did;






1. select * from emp left OUTER join dept on emp.dep_id=dept.did;
2. select * from emp right OUTER join dept on emp.dep_id=dept.did;

posted @ 2024-09-08 16:43  wangyin0425  阅读(6)  评论(0编辑  收藏  举报