Junções internas (II)
Aqui, você vai continuar treinando suas habilidades com a INNER JOIN. Usaremos a tabela album
como da última vez, mas vamos fazer a junção dela com uma nova tabela – artist
– que consiste em duas colunas: artist_id
e name
.
Este exercício faz parte do curso
Introdução ao SQL Server
Instruções do exercício
- Selecione as colunas
album_id
etitle
dealbum
(nome da tabela de origem principal). - Selecione a coluna
name
deartist
e chame-a deartist
. - Identifique uma coluna em comum entre as tabelas
album
eartist
e execute uma junção interna.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
-- Select album_id and title from album, and name from artist
SELECT
___,
___,
___ AS artist
-- Enter the main source table name
FROM ___
-- Perform the inner join
INNER JOIN ___ on ___.___ = ___.artist_id;