SQL Query to Find Teachers Teaching More Than 5 Courses
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;\
原文地址: https://www.cveoy.top/t/topic/pxlW 著作权归作者所有。请勿转载和采集!