how to do the following query in mysql, help

-2

Good day, I have a problem to make a query on mysql because I am totally inexperienced. I would like to know if someone can help me get what I need. In the image is the whole explanation:

    
asked by NovaTito 02.04.2018 в 23:24
source

3 answers

2

You are very close to what you want:

SELECT id_alumno, nombre, universidad, AVG(calificacion)
FROM alumno JOIN universidad ON id_universidad
    JOIN calificaciones ON id_alumno
GROUP BY id_alumno
    
answered by 02.04.2018 в 23:34
2

I think it would be more or less like this:

select a.nombre, u.nombre, a.ciudad, avg(c.calificacion) as promedio  from alumno a
inner join univerisdad on(a.id_universidad=u.id_universidad)
inner join calificaciones c on (a.id_lumno = c.id_alumno)
group by id_alumno
    
answered by 02.04.2018 в 23:39
2

I think it's something similar to this:

SELECT a.id_alumno,
       a.nombre,
       a.ciudad,
       u.universidad,
       (select AVG(c.calificacion) from calificaciones c where c.id_alumno = a.id_alumno) as promedio
FROM alumno a 
JOIN universidad on u.id_universidad = a.id_universidad

or also as exemplified by others:

SELECT a.id_alumno,
       a.nombre,
       a.ciudad,
       u.universidad,
       AVG(c.calificacion) as promedio
FROM alumno a 
JOIN universidad u on u.id_universidad = a.id_universidad
JOIN calificaciones c on c.id_alumno = a.id_alumnno 
group by a.alumno
    
answered by 02.04.2018 в 23:44