The given SQL query selects the name of teachers (tname) and the count of courses (cno) taught by each teacher, where the count is greater than 5.

SELECT t.tname, COUNT(s.cno) OVER (PARTITION BY s.cno) AS coun
FROM t_scores s
JOIN t_courses c ON s.con = c.cno
JOIN t_teachers t ON c.tno = t.tno
WHERE coun > 5;
sqlSelect ttname CountscnoOverPartition By scnocounFrom t_scores sJoin t_courses c On scon = ccno Join t_teachers t On ctno=ttnoWhere coun5;

原文地址: https://www.cveoy.top/t/topic/hOhj 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录