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

秘宇宸-子查询

2024-05-14 12:16:14
0
174

SELECT last_name ,salary
FROM employees
WHERE salary>(
SELECT salary
FROM employees
WHERE last_name='ABEL'

)

#单行子查询

SELECT *
FROM employees
WHERE salary>(
SELECT salary
FROM employees
WHERE employee_id=149
);


SELECT job_id,salary,last_name
FROM employees
WHERE job_id=(
SELECT job_id
FROM employees
WHERE employee_id=141
)
AND salary>(
SELECT salary
FROM employees
WHERE employee_id=143


);




SELECT last_name, job_id, salary
FROM employees
WHERE salary =(
SELECT MIN(salary)
FROM employees

);


SELECT last_name,job_id, MIN(salary)
FROM employees;



SELECT employee_id,manager_id,department_id
FROM employees
WHERE manager_id=(
SELECT manager_id
FROM employees
WHERE employee_id=141
)
AND department_id=(
SELECT department_id
FROM employees
WHERE employee_id=141
)
AND employee_id<>141;

SELECT employee_id,manager_id,department_id
FROM employees
WHERE (manager_id,department_id)=(
SELECT manager_id,department_id
FROM employees
WHERE employee_id=141


)
AND employee_id<>141;


SELECT department_id,MIN(salary)
FROM employees
GROUP BY department_id
HAVING MIN(salary)>(
SELECT MIN(salary)
FROM employees
WHERE department_id=110
);

SELECT employee_id,last_name
FROM employees
WHERE salary >(
SELECT MIN(salary)
FROM employees
GROUP BY department_id
WHERE department_id=110

);






评论
意见反馈