Scalar & Row Subqueries

Published July 26, 2025 By Sai Sree Ram Gundepudi

Scalar and Row Subqueries

Scalar Subquery

Returns a single value (one row, one column).

SELECT first_name, salary
FROM employees
WHERE salary > (SELECT AVG(salary) FROM employees);

Row Subquery

Returns an entire row.

SELECT * FROM employees
WHERE (department_id, job_id) = (SELECT department_id, job_id FROM employees WHERE employee_id = 101);

Was this solution helpful?

Your feedback helps improve our technical knowledge repository.

Share this article