MySQL Questions and Answers – Performing Multiple – Table Retrievals with Joins

This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on “Performing Multiple – Table Retrievals with Joins”.

1. SELECT select_list FROM table_list WHERE row_constraint GROUP BY grouping_columns; Which of these is not optional?
a) select_list
b) table_list
c) row_constraint
d) grouping_columns
View Answer

Answer: a
Explanation: Given above was a basic syntax of the SELECT statement. Everything in the syntax is optional except the ‘select_list’ option. All the others are free to be omitted, and will work fine.

2. In inner join, result is produced by matching rows in one table with rows in another table.
a) True
b) False
View Answer

Answer: a
Explanation: The inner join is a form of join in MySQL that is used to combine the result of concatenating the contents of two tables into a new table. In inner join, result is produced by matching rows in one table with rows in another table.

3. The join where all possible row combinations are produced is called _________
a) INNER JOIN
b) OUTER
c) NATURAL
d) CARTESIAN
View Answer

Answer: d
Explanation: In ‘cartesian product’, each row of each table is combined with each row in every other table to produce all possible combination. This produces a very large number of rows since the number is the product of rows.
advertisement
advertisement

4. The clause that filters JOIN results is called _________
a) WHERE
b) SORT
c) GROUP
d) GROUP BY
View Answer

Answer: a
Explanation: Sometimes the result of a join is very large and is not desirable. In these cases, the results can be filtered with the help of the ‘WHERE’ clause which is followed by a set of condition(s).

5. CROSS JOIN and JOIN are similar to __________
a) INNER JOIN
b) NATURAL JOIN
c) OUTER JOIN
d) CARTESIAN JOIN
View Answer

Answer: a
Explanation: The joins ‘CROSS JOIN’ and ‘JOIN’ types are exactly similar to the ‘INNER JOIN’. The statements containing ‘INNER JOIN’ can replace it with ‘CROSS JOIN’ or ‘JOIN’ to get exactly the same result.

6. The comma operator can also be used to join tables.
a) True
b) False
View Answer

Answer: a
Explanation: The comma (,) operator can be used to join the tables as well. It joins them in the ‘INNER JOIN’ type. It is not desirable to use the comma operator since it has different precedence rules.

7. The left and right joins are also known as __________
a) INNER JOIN
b) NATURAL JOIN
c) OUTER JOIN
d) CARTESIAN JOIN
View Answer

Answer: c
Explanation: The ‘inner join’ only deals with rows where a match can be found in both tables. The ‘LEFT JOIN’ and ‘RIGHT JOIN’ types are ‘OUTER JOIN’ types which differ from inner joins in this sense.
advertisement

8. What is joining a table to itself called?
a) COMPLETE
b) SELF
c) OBSOLETE
d) CROSS
View Answer

Answer: b
Explanation: Joining a table to itself in a database is called ‘self-join’. When a self-join is being performed, the table is being used multiple times within the query and a table name qualifier is unnecessary.

9. In which join all the rows from the left table appear in the output irrespective of the content of the other table?
a) RIGHT JOIN
b) LEFT JOIN
c) INNER JOIN
d) OUTER JOIN
View Answer

Answer: b
Explanation: In a ‘LEFT JOIN’, the output is produced for every row of the left table, even if it does not exist in the right table. This is the reason it is called a ‘LEFT JOIN’. ‘LEFT JOIN’ is a kind of OUTER JOIN.
advertisement

10. The join in which all the rows from the right table appear in the output irrespective of the content of the other table is ___________
a) CARTESIAN JOIN
b) CROSS JOIN
c) INNER JOIN
d) RIGHT JOIN
View Answer

Answer: d
Explanation: In a ‘RIGHT JOIN’, the output is produced for every row of the right table, even if it does not exist in the other table. This is the reason why it is called a ‘RIGHT JOIN’. ‘RIGHT JOIN’ and ‘LEFT JOIN’ are a kind of OUTER JOIN.

Sanfoundry Global Education & Learning Series – MySQL Database.

To practice all areas of MySQL Database, 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.