标签:并且 方式 rom employee where sele 恢复 inner art
---恢复内容开始---
主要内容
1 多表连接查询
语法: select 字段列表
from 表一 inner/left/right join 表二
on 表一.字段 = 表二.字段
内连接: 直连接匹配的行:
select * from employee inner join department on employee.dep_id = department.id;
select * from employee , department where employee.dep_id = department.id;和上面的效果一样.
左连接 : 显示左表的全部记录:
select * from employee left join department on employee.dep_id = department.id;
右连接 : 显示右表的全部记录:
select * from employee rightr join department on employee.dep_id = department.id;
显示全部记录:
select * from employee left join department on employee.dep_id = department.id;
union
select * from employee rightr join department on employee.dep_id = department.id;
符合条件连接查询:
示例1: 以内连接的方式查询employee和department表,并且employee表中的age字段值必须大于25,即找出年龄大于25岁的员工以及员工所在的部门
---恢复内容结束---
标签:并且 方式 rom employee where sele 恢复 inner art
原文地址:https://www.cnblogs.com/gyh412724/p/9683595.html