Basic Join Part 2
Parte de la sección Fundamentos del Journey de SQL de Coddy — lección 44 de 72.
Los joins también se pueden utilizar en las tablas que creamos. Para combinar tablas anidadas con joins, necesitamos añadir AS para identificar la consulta anidada con un nombre.
Por ejemplo:
SELECT table1.col1, table2.col2, ...
FROM table1, (SELECT * FROM table) AS table2
WHERE table1.id = table2.idDesafío
FácilTablas y columnas disponibles:
<strong>grades</strong>:<strong>course_id</strong>,<strong>student_id</strong>,<strong>grade</strong><strong>students</strong>:<strong>id</strong>,<strong>name</strong>
Calcula para cada estudiante su calificación promedio y devuelve el nombre y la calificación promedio de cada uno.
Nombra las columnas student, grade.
Redondea el promedio a 2 decimales y ordena el resultado por la calificación promedio en orden ascendente.
Hoja de referencia
Para unir tablas con consultas anidadas, use AS para nombrar la consulta anidada:
SELECT table1.col1, table2.col2, ...
FROM table1, (SELECT * FROM table) AS table2
WHERE table1.id = table2.idPruébalo tú mismo
Esta lección incluye un breve cuestionario. Empieza la lección para responderlo y registrar tu progreso.
Todas las lecciones de Fundamentos
4More Keywords
The IN keywordThe BETWEEN keywordThe LIKE keywordThe AS keywordRecap - Cellphone Models2Conditions
Conditions BasicsThe AND keywordThe OR keywordThe NOT keywordMultiple Conditions CombinedParenthesisBooleans5Arithmetic Operations
Mathematical OperatorsMathematical ColumnsThe Modulo OperationThe ROUND() Function3Specific Return Format
Null valuesSort Results Part 1Sort Results Part 2Recap - Cyber Security FirmLimit number of recordsRecap - Vehicle Factory6Intro Challenges
Recap - Parliamentary ElectionRecap - Police Criminal ArrestRecap - Bar Beverage ContainerRecap - Engineer new columns