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
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
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
Explanation: If on keyword is not used in a query, then the join condition must be specified in the where clause.
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)
SELECT column_list FROM table1 ON table1.column = table2.column INNER JOIN table2;
d)
SELECT column_list FROM table1 INNER JOIN table2 table1.column = table2.column;
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
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.