Beginner

667. JOIN with Greater Than

Use greater-than comparisons in JOIN conditions.

📘 Lesson 667 of 728 ⏱ 13 min 🎯 Advanced

A greater-than JOIN matches rows when a value from one table is greater than a value from another table.

This pattern is useful for comparisons, threshold analysis, and range-based relationships.

Find employees whose salary is greater than a defined benchmark.

SQL
SELECT
    e.EmployeeName,
    e.Salary,
    b.BenchmarkSalary
FROM Employees e
INNER JOIN SalaryBenchmarks b
    ON e.DepartmentID = b.DepartmentID
   AND e.Salary > b.BenchmarkSalary;

Used in compensation analysis, financial comparisons, pricing, and threshold reporting.

  • Uses > in the JOIN condition.
  • Often combined with an equality condition.
  • Can produce multiple matches.
  • Useful for threshold comparisons.
  • Indexes may behave differently than equality JOINs.
What is a greater-than JOIN?

It matches rows when a value from one table is greater than a value in another table.

Can greater-than JOINs return multiple matches?

Yes. A row can satisfy the condition against multiple rows in the other table.

Have you finished this lesson?

Introduction to SQL – All Lessons