第1关:字符函数
#请在此添加实现代码
########## Begin ##########
SELECT concat(UPPER(SUBSTRING(name,1,1)),LOWER(SUBSTRING(name,2))) Name FROM employee;
########## End ##########
第2关:数学函数
#请在此添加实现代码
########## Begin ##########
update Score set s_score=TRUNCATE(s_score-(round(sqrt((power(4,4)-power(3,3))/power(2,2)),2)),2);
SELECT s_name,s_score from Score
########## End ##########
第3关:日期时间函数和流程控制类函数
#请在此添加实现代码
########## Begin ##########
select year(s_birth) as Year,timestampdiff(YEAR,s_birth,CURDATE()) as "Age" from Student ;
select Course.c_id as 课程号 ,
max(Score.s_score) as 最高分,
min(Score.s_score) as 最低分,
round(AVG(Score.s_score),2) as 平均分,
CONCAT(TRUNCATE(COUNT(s_score >=60 OR null)/COUNT(s_score)*100,2),'%')as 及格率
from Course join Score on Course.c_id=Score.c_id GROUP by Score.c_id;
########## End ##########
第4关:自定义函数
#请在此添加实现代码
########## Begin ##########
delimiter //
create function fn_three_max(param_1 int,param_2 int,param_3 int) RETURNS int
BEGIN
DECLARE max_val int DEFAULT 0;
if param_1 > param_2 then
set max_val=param_1;
else
set max_val=param_2;
end if;
if param_3 > max_val then
set max_val=param_3;
end if;
return max_val;
END
//
########## End ##########