SQL Questions and Answers – SQL Joins

This set of SQL Multiple Choice Questions & Answers (MCQs) focuses on “SQL Joins”.

1. Which clause is used to fetch data from two or more tables, based on conditions between tables?
a) Combine
b) Join
c) Merge
d) Add
View Answer

Answer: b
Explanation: SQL JOIN clause is used to fetch data from two or more tables. Based on a related column between the tables, we can combine rows from two or more tables using JOIN clause.

2. Which of the following type of join returns a list of rows for which there is a match in both of the specified tables?
a) Outer join
b) Full join
c) Self join
d) Inner join
View Answer

Answer: d
Explanation: Inner join returns those records that have matching values in both the tables. The result of this join is based on matched data as per the equality condition specified in the SQL query.

3. Which of the following is a default join type?
a) Outer join
b) Inner join
c) Left join
d) Right join
View Answer

Answer: b
Explanation: Inner join Selects records that have matching values in both the tables. It’s the default join type, so if we just type JOIN without specifying any other conditions, an INNER JOIN will be used.
advertisement
advertisement

4. Which type of join returns all the records from the left table, and the matched records from the right table?
a) Right join
b) Inner join
c) Left join
d) Self join
View Answer

Answer: c
Explanation: LEFT JOIN returns all the rows of the table on the left side of the join and matching rows for the table on the right side of join. Left join is also known as left outer join.

5. Which type of join returns all the rows of the table on the right side of the join and matching rows for the table on the left side of join?
a) Right join
b) Left join
c) Full join
d) Inner join
View Answer

Answer: a
Explanation: RIGHT JOIN returns all the records from the right table, and the matched records from the left table of the join. Right join is also known as right outer join.

6. Which type of join returns all the records when there is a match in either left or right table?
a) Join
b) Full join
c) Self join
d) Cartesian join
View Answer

Answer: b
Explanation: FULL JOIN will return all the results from both the left and the right tables of our statement. It is a combination of left outer join and right outer join.

7. How many conditions are required to join N number of tables?
a) N conditions
b) N+1 conditions
c) N-2 conditions
d) N-1 conditions
View Answer

Answer: d
Explanation: Using SQL JOIN keyword we can combine one or more tables depending on the given conditions. Minimum required condition for joining table, is N-1 where N is the number of tables.
advertisement

8. In a query, JOIN condition can be used for only one time.
a) True
b) False
View Answer

Answer: b
Explanation: JOIN condition can be used for more once in a single query. To join n tables, we require n-1 number of conditions.

Sanfoundry Global Education & Learning Series – SQL.

advertisement

To practice all areas of SQL, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.