From the course: Oracle Database 19c: Basic SQL

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Subqueries

Subqueries

From the course: Oracle Database 19c: Basic SQL

Start my 1-month free trial

Subqueries

- [Narrator] In this video, I'm going to demystify subqueries by presenting the most common use cases. What a subquery is, how it's constructed, the different types of subqueries and the rules surrounding the use of subqueries. What exactly is a subquery? Essentially, it's another query embedded within a main query. You can reference a subquery just about anywhere a table is referenced, such as in a from clause or even in the select clause column list. You could also use a subquery in where clause to help you filter the results of the main query, and you'll see an example a bit later. Subqueries can be nested 255 deep. Finally, a subquery can be correlated or not correlated. I'll show you an example of these as well. In the where clause, a subquery is often uncorrelated, even though the is referenced in the subquery might also be referenced in the main query. In the example I want to find all employees, whose salary is greater than the average salary of all employees. The first select…

Contents