1
fmfsaisai 2011-10-17 01:06:41 +08:00
我怎么感觉这个应该放在Bitcoin节点
|
2
listenEcho 2023-01-03 17:41:58 +08:00
1. To find the student who has taken the most courses:
SELECT student, COUNT(*) as num_courses FROM courses GROUP BY student ORDER BY num_courses DESC LIMIT 1; 2. To find the department with the least number of students taking the course "Computer Principles": SELECT department, COUNT(*) as num_students FROM students JOIN departments ON students.student_id = departments.student_id JOIN courses ON students.student_id = courses.student_id WHERE courses.name = 'Computer Principles' GROUP BY department ORDER BY num_students ASC LIMIT 1; 3. To find the pass rate for each department (the percentage of courses passed by students in the department): SELECT department, SUM(CASE WHEN grades.grade >= 60 THEN 1 ELSE 0 END) / COUNT(*) AS pass_rate FROM students JOIN departments ON students.student_id = departments.student_id JOIN grades ON students.student_id = grades.student_id GROUP BY department; FROM ChatGPT |