SQL Questions and Answers – SQL Inner Join

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

1. When there are no matching values between two tables of a database, which of the following join returns zero records?
a) Self join
b) Full join
c) Inner join
d) Right join
View Answer

Answer: c
Explanation: The INNER JOIN keyword selects all rows from both the tables as long as the condition satisfies. If no matching values exist between them, they cannot be combined and hence results in zero records.

2. Which of the following keyword can be used along with INNER JOIN in SQL?
a) Of
b) On
c) By
d) Combine
View Answer

Answer: b
Explanation: ON keyword can be used along with INNER JOIN, whenever the join condition is not specified in where clause. If the join condition is specified in WHERE clause, then there is no need of ON.

3. Where the join condition should be mentioned, if ON keyword is not used in a query?
a) From
b) Select
c) Where
d) Join
View Answer

Answer: c
Explanation: If on keyword is not used in a query, then the join condition must be specified in the where clause.
advertisement
advertisement

4. What is the basic syntax for using INNER JOIN?
a)

SELECT column_list
FROM table1
INNER JOIN table2 ON table1.column = table2.column;

b)

SELECT column_list
FROM table1
INNER JOIN table2;

c)

advertisement
SELECT column_list
FROM table1 ON table1.column = table2.column
INNER JOIN table2;

d)

advertisement
SELECT column_list
FROM table1
INNER JOIN table2 table1.column = table2.column;
View Answer
Answer: a
Explanation: Inner join is used to combine two or more tables based on a given condition. So, condition is necessary for INNER JOIN. Either ON or WHERE clause should be used to mention the condition(s).

5. Which of the following sets is similar to table1 INNER JOIN table2?
a) Table1 U Table2
b) Table1 – Table2
c) Table1 ∩ Table2
d) Table1 – Table2
View Answer

Answer: c
Explanation: Table1 ∩ Table2 results the matching columns between those tables. SQL INNER JOIN returns all rows from multiple tables where the join condition is met. So Table1 INNER JOIN Table2 is similar to Table1 ∩ Table2.

Sanfoundry Global Education & Learning Series – SQL.

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

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.