diff --git a/2208/天天乐学考试答案/MySQL练习(一).md b/2208/天天乐学考试答案/MySQL练习(一).md index ba84b72..3361caa 100644 --- a/2208/天天乐学考试答案/MySQL练习(一).md +++ b/2208/天天乐学考试答案/MySQL练习(一).md @@ -58,7 +58,22 @@ SELECT * FROM t_salary WHERE money >= 5000 AND money <= 8000; -#6 +#6 tj13 分组查询 +SELECT eid, MAX(money) +FROM t_salary +GROUP BY eid; + +#7 tj14 多表联查+条件过滤 +SELECT d.dname, e.ename +FROM t_employee e, t_department d +WHERE e.did = d.did AND e.position = '经理'; + +#8 +CREATE VIEW v_hrm AS +SELECT d.dname, e.ename, s.money, s.stime +FROM t_employee e, t_department d, t_salary s +WHERE e.did = d.did AND e.eid = s.eid +ORDER BY s.stime DESC; #9 触发器 DELIMITER $$ @@ -98,3 +113,4 @@ CALL pro_GetTopSalary('d0001', @result); SELECT @result; ``` +### 第二套