AshwaDip Tutorials

  1. Oracle
  2. Fundamentals of DB
  3. SQL
  4. SQL LANGUAGES
  5. CONSTRAINTS
  6. OPERATORS
  7. JOINS
  8. SUB - QUERIES
  9. DB OBJECTS
  10. PARTITIONS
  11. FUNCTIONS
  12. PL/SQL
  13. PLSQL Interview

7. SUB - QUERIES


• Single row sub-queries
• Multi-row sub-queries
• Correlated Sub-Queries
• Use of EXISTS / NOT EXISTS /ANY /ALL

In Oracle, subqueries are the queries inside a query. Subqueries can be made using WHERE, FROM or SELECT clause.

Single Row Sub Query
A single-row subquery is used when the outer query's results are based on a single, unknown value. Although this query type is formally called "single-row," the name implies that the query returns multiple columns-but only one row of results.

Multiple Row Sub Query
Multiple-row subqueries are nested queries that can return more than one row of results to the parent query.

Correlated subquery whose some clauses refer to the column expressions in the outer query. EXISTS / NOT EXISTS /ANY /ALL