Auto commit
This commit is contained in:
parent
947c7e78d2
commit
cc59f1a38b
@ -324,3 +324,18 @@ SELECT is_high_salary_department(1);
|
||||
#### 练习题 10: 计算员工的总收入
|
||||
|
||||
创建一个存储函数 `calculate_total_income`,接受员工的工资和奖金(假设奖金为工资的 10%)作为参数,返回其总收入(工资 + 奖金)。
|
||||
|
||||
```sql
|
||||
DELIMITER $$
|
||||
DROP FUNCTION IF EXISTS calculate_total_income;
|
||||
CREATE FUNCTION calculate_total_income(sal DECIMAL(10, 2))
|
||||
RETURNS DECIMAL(10, 2)
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
RETURN sal*1.2;
|
||||
END $$
|
||||
DELIMITER ;
|
||||
|
||||
SELECT calculate_total_income(3000);
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user