Home > database >  Basic lookup mysql programming for help
Basic lookup mysql programming for help

Time:10-12


Now have three tables (pictured), the topic is: the query of the highest average course information,
Beg a mysql code

CodePudding user response:

Select avg (sc) Grade), Arthur c. name from sc
Inner join course as c on sc. Cno=Arthur c. no
Group by sc. Cno;

CodePudding user response:

Upstairs is correct, but may consider statistical correlation discipline table again after the completion of the

The select a.c name, b.a vg_grade from course as b
Inner join
(select avg (grade) as avg_grade, cno from sc group by cno) as b
On a.c no=biggest no

CodePudding user response:


SELECT AVG (sc) Grade) AS avg_score, Arthur c. name FROM sc
INNER JOIN course AS c ON sc. Cno=Arthur c. no
GROUP BY sc. Cno
The ORDER BY avg_score DESC LIMIT 1
  • Related