SQL Server Joins

  Home  MS SQL Server  SQL Server Joins


“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.

 182 views

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

 172 views

5⟩ 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.

 181 views

6⟩ 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.

 196 views

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.

 219 views

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;

 181 views

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.

 213 views

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

 171 views

11⟩ What is RIGHT OUTER JOIN?

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

Example: To display Bonus irrespective of whether they are an employee or not.

Select * From employee RIGHT OUTER JOIN bonus ON employee.bonusID=bonus.bonusID

 157 views

12⟩ What is FULL OUTER JOIN?

A full outer join will combine results of both left and right outer join. Hence the records from both tables will be displayed with a NULL for missing matches from either of the tables.

Example: To display employees who have a bonus and to display bonus even if he is not an employee.

Select * From employee FULL OUTER JOIN bonus ON employee.bonusID=bonus.bonusID

 178 views

13⟩ Explain RDBMS?

Relational Data Base Management Systems (RDBMS) are database management systems that maintain data records and indices in tables. Relationships may be created and maintained across and among the data and tables. In a relational database, relationships between data items are expressed by means of tables. Inter-dependencies among these tables are expressed by data values rather than by pointers. This allows a high degree of data independence. An RDBMS has the capability to recombine the data items from different files, providing powerful tools for data usage.

 197 views

14⟩ Explain the properties of the Relational tables?

☛ Values are atomic.

☛ Column values are of the same kind.

☛ Each row is unique.

☛ The sequence of columns is insignificant.

☛ The sequence of rows is insignificant.

☛ Each column must have a unique name.

 181 views

15⟩ What is De-normalization?

De-normalization is the process of attempting to optimize the performance of a database by adding redundant data. It is sometimes necessary because current DBMSs implement the relational model poorly. A true relational DBMS would allow for a fully normalized database at the logical level, while providing physical storage of data that is tuned for high performance. De-normalization is a technique to move from higher to lower normal forms of database modeling in order to speed up database access.

 211 views

16⟩ What is 1NF normalization form?

Eliminate Repeating Groups Make a separate table for each set of related attributes, and give each table a primary key. Each field contains at most one value from its attribute domain.

 186 views

18⟩ What is 3NF normalization form?

Eliminate Columns Not Dependent On Key If attributes do not contribute to a description of the key, remove them to a separate table. All attributes must be directly dependent on the primary key.

 185 views