2.8.sql 248 Bytes
Newer Older
Matias Ferreira committed
1 2 3 4 5 6 7 8 9 10
/*2.8. Hacer un query que liste los códigos de los 3 cursos con mayor cantidad de inscriptos.*/

SELECT code, count(*)
FROM enrollments en
  LEFT JOIN
    courses co
  ON en.course_iid = co.course_iid
GROUP BY code
ORDER BY count(*) DESC
LIMIT 3;