Explain sub-queries in brief.
A sub-query is a query within a query. It is embedded within the WHERE clause of the first query. It is used to return data that is used in main query as a condition.
Example:To return salary for the employee’s id in employee table.
Select emp_id, emp_name from employee
Where emp_id IN (select emp_id FROM salary);
Explain sub-queries in brief.
Sub-query is the technique that lets us use the result of one query as part of another query. Sub-queries are very simple to implement and understand. Some queries can't be solved without sub queries.