MS SQL Server Joins Interview Preparation Guide
Download PDF
Add New Question

MS SQL Server joins job interview questions and answers guide. The one who provides the best MS SQL Server joins answers with a perfect presentation is the one who wins the interview race. Learn SQL Server Joins and get preparation for the job of MS SQL Server joins

49 SQL Server Joins Questions and Answers:

1 :: Explain a join?

Joins are used in queries to explain how different tables are related.
Joins also let you select data from a table depending upon data from another table.
Post Your Answer

2 :: Can you explain different types of joins?

Types of joins: INNER JOINs, OUTER JOINs, CROSS JOINs.
OUTER JOINs are further classified as LEFT OUTER JOINS, RIGHT OUTER JOINS and FULL OUTER JOINS.
Post Your Answer

3 :: What are different Types of Join?

A join is typically used to combine results of two tables. A Join in SQL can be:-

Inner joins
Outer Joins
Left outer joins
Right outer joins
Full outer joins
Inner join

An inner join looks for matching records taken from one table from another.
A left outer join limits results to the table in left of JOIN.
A right outer join limits results to the table in right of JOIN.
Full outer joins are the combination of left and right outer joins
Post Your Answer

4 :: What is a self join in SQL Server?

Two instances of the same table will be joined in the query.
Post Your Answer

5 :: Explain Nested Join?

In nested joins, for each tuple in the outer join relation, the system scans the entire inner-join relation and appends any tuples that match the join-condition to the result set.
Post Your Answer

6 :: What is Merge join?

Merge join If both join relations come in order, sorted by the join attribute(s), the system can perform the join trivially, thus: It can consider the current group of tuples from the inner relation which consists of a set of contiguous tuples in the inner relation with the same value in the join attribute. For each matching tuple in the current inner group, add a tuple to the join result. Once the inner group has been exhausted, advance both the inner and outer scans to the next group.
Post Your Answer

7 :: What is Hash join?

A hash join algorithm can only produce equi-joins. The database system pre-forms access to the tables concerned by building hash tables on the join-attributes.
Post Your Answer

8 :: What is inner join? Explain with an example?

INNER JOIN: Inner join returns rows when there is at least one match in both tables.

Syntax:

SELECT column_name(s) FROM table_name1 INNER JOIN table_name2 ON table_name1.column_name=table_name2.column_name

Example: To display records of an employee who got an appraisal.

SELECT employee.firstname, appraisal.amount FROM employee INNER JOIN appraisal ON employee.id = appraisal.employee.id;
Post Your Answer

9 :: What is OUTER JOIN?

In An outer join, rows are returned even when there are no matches through the JOIN criteria on the second table.
Post Your Answer

10 :: What is LEFT OUTER JOIN?

A left outer join or a left join returns results from the table mentioned on the left of the join irrespective of whether it finds matches or not. If the ON clause matches 0 records from table on the right, it will still return a row in the result—but with NULL in each column.

Example: To display employees irrespective of whether they have got bonus.
Select * From employee LEFT OUTER JOIN bonus ON employee.bonusID=bonus.bonusID
Post Your Answer
Add New Question