SQL 查询中的个案?
Cases in SQL Query?
我有一个查询 MySQL
Give all managers of First Bank Corporation a 10 percent salary raise unless the salary become greater than 0000; in such cases, give only a 3 percent raise.
在我的数据库中,我有以下 Table 我必须处理的
- 员工(emp_name,街道,城市)
- 工作(emp_name,company_name,工资)
- 公司(company_name,城市)
- 管理(emp_name,manager_name)`
我已经完成了一半的查询,现在我不知道如何做它的另一部分
Update Works
set Salary= salary + salary * 0.10
where company_name = 'First Bank Corporation' AND
emp_name IN (Select manager_name from Manages) AND
salary > 100000;
UPDATE ...
SET salary = CASE
WHEN salary * 1.10 > 100000
THEN salary * 1.03
ELSE salary * 1.10
END
WHERE ...
-或-
UPDATE ...
SET salary = salary * CASE
WHEN salary * 1.10 > 100000
THEN 1.03
ELSE 1.10
END
WHERE ...
我有一个查询 MySQL
Give all managers of First Bank Corporation a 10 percent salary raise unless the salary become greater than 0000; in such cases, give only a 3 percent raise.
在我的数据库中,我有以下 Table 我必须处理的
- 员工(emp_name,街道,城市)
- 工作(emp_name,company_name,工资)
- 公司(company_name,城市)
- 管理(emp_name,manager_name)`
我已经完成了一半的查询,现在我不知道如何做它的另一部分
Update Works
set Salary= salary + salary * 0.10
where company_name = 'First Bank Corporation' AND
emp_name IN (Select manager_name from Manages) AND
salary > 100000;
UPDATE ...
SET salary = CASE
WHEN salary * 1.10 > 100000
THEN salary * 1.03
ELSE salary * 1.10
END
WHERE ...
-或-
UPDATE ...
SET salary = salary * CASE
WHEN salary * 1.10 > 100000
THEN 1.03
ELSE 1.10
END
WHERE ...