首页 小组 文章 相册 留言本 用户 搜索 我的社区 在线学堂 商城 购物车 支付钱包

[打卡]陈煜杭--脑瓜子嗡嗡的吧

2024-04-12 12:11:35
1
146


select e.employee_id,e.last_name,d.department_name,l.city from employees e,departments d,locations l where e.department_id=d.department_id and d.location_id=l.location_id;
/*
 提出一个问题 ... 解决一个问题 ... 提出第二个问题... 解决第二个问题...
*/
#多表查询的分类用的是归纳式
/*
角度1:等值链接 vs 非等值连接
角度2:自连接(自我引用) vs 非自连接
角度3:内连接 vs 外连接
*/

#角度1:等值链接 vs 非等值连接
select *from job_grades;
#查询名字,月薪和对应的等级
select e.last_name,e.salary,j.grade_level from employees e,job_grades j where e.salary between j.lowest_sal and j.highest_sal;
---------------------
select e.last_name,e.salary,j.grade_level from employees e,job_grades j  where e.salary>=j.lowest_sal and e.salary<= j.highest_sal;
#角度2:自连接(自我引用) vs 非自连接
select * from employees;
#查询员工id,员工的姓名及其管理者的id和姓名
select emp.employee_id,emp.last_name,mgr.employee_id,mgr.last_name from employees emp,employees mgr where emp.manager_id=mgr.employee_id;
select * from employees;
评论 (1)
意见反馈