ComenzarEmpieza gratis

RIGHT JOIN

Probemos ahora algunas uniones RIGHT. Una unión RIGHT devolverá todas las filas de la tabla de la derecha, más las coincidencias de la tabla de la izquierda.

Además de realizar una unión RIGHT, también aprenderás a evitar problemas cuando diferentes tablas tienen los mismos nombres de columna, cualificando completamente la columna en tu declaración select. Recuerda que lo hacemos añadiendo como prefijo del nombre de columna el nombre de tabla.

Para este ejercicio, volveremos a la base de datos Chinook de antes.

Este ejercicio forma parte del curso

Introducción a SQL Server

Ver curso

Ejercicio interactivo práctico

Prueba este ejercicio completando el código de muestra.

-- SELECT the fully qualified album_id column from the album table
SELECT 
  ___,
  title,
  album.artist_id,
  -- SELECT the fully qualified name column from the artist table
  ___ as artist
FROM album
-- Perform a join to return only rows that match from both tables
INNER JOIN artist ON album.artist_id = artist.artist_id
WHERE album.album_id IN (213,214)
Editar y ejecutar código