Skip to main content

Command Palette

Search for a command to run...

Subqueries

When to Use

Published
1 min read
D

I ❤️ Oracle APEX

Use subqueries when you need to pass the result of one query as input to another, often for filtering or comparisons.

Example: Find Employees Who Earn More Than Their Departments Average

SELECT employee_id, name, salary 
FROM employees e 
WHERE salary > ( 
  SELECT AVG(salary) 
  FROM employees e
  WHERE department_id = e.department_id);