The queries used inside the other query is known as the Subqueries. The subquery is also called as Inner query and Nested query. The subquery is used when we know how to search using the statements but don't know the exact value in the whole database.
The query can reside in the
Example for subquery :
SELECT first_name,last_name,salary,age,gender FROM persons_table WHERE salary IN (SELECT salary FROM persons_table WHERE last_name='Patil');
The above table is the data retrieved by the persons_table.
In the above query, the first_name, last_name, salary, age, and gender are selected from the persons_table. But we don't know the salary of that particular person. So, we use a subquery to give furthermore details based on the last_name of the person.
The most commonly used functions in the subqueries are as follows.