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

[打卡]lululu

2024-04-12 12:13:43
0
133

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;

select employee_id,last_name,department_name,city
from employees e,departments d,locations l
where e.employee_id=d.department_id
and d.location_id=l.location_id;


-- 多表查询的分类 用归纳式
/*
角度1:等值连接 VS 非等值连接
角度2:自连接(自我引用)VS 非自连接
角度3:内连接 VS 外连接
*/
#角度1:等值连接 vs 非等值连接
select * from job_grades;
# 查询名字、月薪和对应的等级

select last_name,salary,grade_level
from employees e,job_grades j
where e.salary between j.lowest_sal and j.highest_sal;

select last_name,salary,grade_level
from employees e,job_grades j
where e.salary >= j. lowest_sal and
e.salary <= highest_sal;

# 角度2
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;
























评论
此内容暂不接受评论!
意见反馈