RIGHT JOIN
अब कुछ RIGHT joins आज़माएँ। RIGHT join दाएँ तरफ़ वाली table की सभी rows लौटाता है, और बाएँ तरफ़ की table से मिलने वाले matches भी जोड़ता है.
RIGHT join करने के अलावा, आप यह भी सीखेंगे कि जब अलग-अलग tables में एक जैसे column names हों तो समस्याओं से कैसे बचें — इसके लिए SELECT स्टेटमेंट में column को पूरी तरह qualify कीजिए. याद रखें, ऐसा हम column name के आगे table name लगाकर करते हैं.
इस अभ्यास में, हम अध्याय की शुरुआत में इस्तेमाल की गई Chinook database पर वापस आ रहे हैं.
यह अभ्यास पाठ्यक्रम का हिस्सा है
SQL Server परिचय
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
-- 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)