InterviewSolution
Saved Bookmarks
| 1. |
What is a Subquery? What are its types? |
|
Answer» A subquery is a query WITHIN another query, also known as a nested query or inner query. It is used to RESTRICT or enhance the data to be queried by the main query, thus restricting or enhancing the output of the main query respectively. For example, here we fetch the contact information for students who have enrolled for the maths SUBJECT: SELECT name, email, mob, addressFROM myDb.contactsWHERE roll_no IN ( SELECT roll_no FROM myDb.students WHERE subject = 'Maths');There are two types of subquery - Correlated and Non-Correlated.
|
|