9.6

-- 3

SELECT AVG(salary) FROM employees GROUP BY department_id;

SELECT employee_id, last_name, salary, e.`department_id`

FROM employees AS e

INNER JOIN (

SELECT AVG(salary) AS ag, department_id

FROM employees

GROUP BY department_id

) AS ag_dep

ON e.`department_id` = ag_dep.department_id

WHERE salary > ag_dep.ag;

-- 4

SELECT employee_id,CONCAT(first_name,last_name)

FROM employees AS e

INNER JOIN (

SELECT department_id

FROM employees

WHERE CONCAT(first_name,last_name) LIKE 'u%' OR CONCAT(first_name,last_name) LIKE '%u' OR CONCAT(first_name,last_name) LIKE '%u%'

GROUP BY department_id

) AS b

ON e.department_id=b.department_id;

-- 5

SELECT employee_id

FROM employees

WHERE department_id

IN(

SELECT department_id

FROM departments

WHERE location_id=1700

);

-- 6

SELECT last_name, salary

FROM employees

WHERE manager_id

IN(

SELECT employee_id

FROM employees

WHERE last_name = "K_ing"

);

-- 7

SELECT  CONCAT(first_name, '.' ,last_name) "姓.名"

FROM employees

WHERE salary = (

SELECT MAX(salary) FROM employees

);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值