Tags

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,


T-SQL Output Query | [ The JOIN Puzzle – Part 2 ]

–Let’s say we have 2 table TestJoins1 and TestJoins2. Both the tables having only one ID column.Here you have to provide the output of the queries given below. All the queries are using different types of joins.

3

4


--

--Query 1
SELECT t1.ID , t2.ID
FROM [dbo].[TestJoins1] t1 INNER JOIN [dbo].[TestJoins2] t2  ON t1.ID = t2.ID

--Query 2
SELECT t1.ID , t2.ID
FROM [dbo].[TestJoins1] t1 LEFT OUTER JOIN [dbo].[TestJoins2] t2  ON t1.ID = t2.ID

--Query 3
SELECT t1.ID , t2.ID
FROM [dbo].[TestJoins1] t1 RIGHT OUTER JOIN [dbo].[TestJoins2] t2  ON t1.ID = t2.ID

--Query 4
SELECT t1.ID , t2.ID
FROM [dbo].[TestJoins1] t1 FULL OUTER JOIN [dbo].[TestJoins2] t2  ON t1.ID = t2.ID

--

Please leave a comment if you need solution to the above puzzle

Keep Learning