Correlated Subquery example and interview questions
Basics Questions
- What is correlated subquery.
- What is the difference between correlated subquery and normal subquery.
Employee Table :
Department | Employee | Salary |
---|---|---|
IT | Aditya | 5000 |
IT | Joseph | 5500 |
IT | Arya | 6500 |
SALES | Ramu | 8000 |
SALES | Geeta | 7500 |
SALES | Rita | 10000 |
SALES | Pushpendra | 11000 |
Queries on above table
- From the above table find the employees whose salary is greater than the average salary of department.
- Display the employees who are not earning the minimum salary in each department.
- Display the top 2 salary holder employee details in each department.
- Display bottom 2 salary holder employee details in each department.
- Display the employees with their salary difference with department average.
Note :- Correlated subquery can be part of select or where condition and the two queries.
No comments:
Post a Comment