SQL Less Than or Equal To

By: Kris Wenzel   |   Updated: March 6, 2022  
Works With: 

The SQL Less Than Or Equal To comparison operator (<=) is used to compare two values.  It returns TRUE if the first value is less than the second.  If the second is less, it returns FALSE. 

You can also test for Less than by using <.  

Here are a couple of examples: 

10 <=5FALSE
5 <= 20TRUE
10 <= 10TRUE

Here is an example showing how to retrieve all Products whose ListPrice is $100.00 or less.

SQL Less Than or Equal To Operator.

Why not try it for yourself! Try changing the amount to see how the results change.

SQL Less Than or Equal To with Other Types 

You can use the Less than or Equal to comparison with other data type, such as String and DateTime

Here we’re returning products modified before February 15th, 2014. 

SELECT ProductNumber, Name, ListPrice, ModifiedDate
FROM Production.Product
WHERE ModifiedDate <= '2014-02-15'

Notice that the date is implicitly converted to a date type. This query returns any rows on or before 02/15/2014.

When working with text values, such as names and address, keep in mind your DBMS collating order. It will affect how these operators work. In simple terms the collating order is (A-Z) ascending, but you can can that!

Additional Resources 

To learn more about SQL Less than or equal (<=), check out these useful resources: 

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}