Beginner

668. JOIN with Less Than

Use less-than comparisons to create range and comparison JOINs.

📘 Lesson 668 of 728 ⏱ 13 min 🎯 Advanced

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

It can be useful for threshold comparisons and identifying records that fall below reference values.

Find employees whose salary is below their department 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, risk reporting, pricing, and exception analysis.

  • Uses < in the JOIN condition.
  • Can be combined with key-based matching.
  • Useful for below-threshold analysis.
  • May create multiple matches.
  • Test result cardinality carefully.
What does a less-than JOIN do?

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

Why combine < with another JOIN condition?

A key condition can restrict the comparison to the correct business group.

Have you finished this lesson?

Introduction to SQL – All Lessons