開始使用免費開始

INNER JOIN(II)

接下來,你會繼續練習 INNER JOIN。和上一題一樣使用 album 資料表,但這次要把它和新的 artist 資料表做連接。artist 有兩個欄位:artist_idname

本練習屬於課程

SQL Server 入門

檢視課程

練習說明

  • album(主要來源資料表)選取 album_idtitle 欄位。
  • artist 選取 name 欄位,並將其別名設為 artist
  • 找出 albumartist 之間的共同欄位,並進行 INNER JOIN。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

-- 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;
編輯並執行程式碼