Contenido del Curso
SQL Intermedio
SQL Intermedio
Desafío de la Calificación Promedio de los Estudiantes
Has realizado un excelente trabajo y has ayudado a la empresa constructora. Han comenzado a trabajar en la ampliación de la línea de metro Amarilla.
Te han recomendado, y el colegio ha mostrado interés en ti porque también tienen varias tareas para ti. Pero primero, familiaricémonos con la student_grades
tabla que proporcionan:
Como puede ver, la escuela tiene un total de 100 estudiantes, cuya información se proporciona en la tabla adjunta. Hay información en la columna class_letter
, que tiene 3 opciones: A
, B
o C
. Se incluye el nombre de la materia (subject_name
), así como la calificación del estudiante (grade
). La tabla es simple y contiene las calificaciones de exámenes en diversas materias.
Veamos cuántos estudiantes hay en cada clase con la siguiente consulta:
The table contains grades for exams in various subjects.
The school has a total of 100 students, information about whom is provided in the given table. There is information in the class_letter
column, which has 3 options: A
, B
, or C
. The subject name(subject_name
), as well as the student's grade(grade
), are included.
Let's see how many students there are in each class with the following query:
SELECT class_letter, COUNT(DISTINCT student_surname) AS anumber_of_students FROM student_grades GROUP BY class_letter
Swipe to start coding
Your task now is to calculate the average grade for all subjects for each student. Also, for the convenience of the teachers, you need to sort the students' last names in alphabetical order. Use aggregation with the AVG()
function and give an alias average_grade
to ensure successful testing.
Brief Instructions
- Retrieve the
student_surname
column and the average of thegrade
column using theAVG
function. - Add the alias
average_grade
to the second column. - Group the data by
student_surname
. - Sort the results by
student_surname
in ascending order.
Solución
¡Gracias por tus comentarios!
Desafío de la Calificación Promedio de los Estudiantes
Has realizado un excelente trabajo y has ayudado a la empresa constructora. Han comenzado a trabajar en la ampliación de la línea de metro Amarilla.
Te han recomendado, y el colegio ha mostrado interés en ti porque también tienen varias tareas para ti. Pero primero, familiaricémonos con la student_grades
tabla que proporcionan:
Como puede ver, la escuela tiene un total de 100 estudiantes, cuya información se proporciona en la tabla adjunta. Hay información en la columna class_letter
, que tiene 3 opciones: A
, B
o C
. Se incluye el nombre de la materia (subject_name
), así como la calificación del estudiante (grade
). La tabla es simple y contiene las calificaciones de exámenes en diversas materias.
Veamos cuántos estudiantes hay en cada clase con la siguiente consulta:
The table contains grades for exams in various subjects.
The school has a total of 100 students, information about whom is provided in the given table. There is information in the class_letter
column, which has 3 options: A
, B
, or C
. The subject name(subject_name
), as well as the student's grade(grade
), are included.
Let's see how many students there are in each class with the following query:
SELECT class_letter, COUNT(DISTINCT student_surname) AS anumber_of_students FROM student_grades GROUP BY class_letter
Swipe to start coding
Your task now is to calculate the average grade for all subjects for each student. Also, for the convenience of the teachers, you need to sort the students' last names in alphabetical order. Use aggregation with the AVG()
function and give an alias average_grade
to ensure successful testing.
Brief Instructions
- Retrieve the
student_surname
column and the average of thegrade
column using theAVG
function. - Add the alias
average_grade
to the second column. - Group the data by
student_surname
. - Sort the results by
student_surname
in ascending order.
Solución
¡Gracias por tus comentarios!