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:
|5 <= 20||TRUE|
|10 <= 10||TRUE|
Here is an example showing how to retrieve all Products whose ListPrice is $100.00 or less.
Why not try it for yourself! Try changing the amount to see how the results change.
SELECT ProductNumber, Name, ListPrice FROM Production.Product WHERE ListPrice <= 100 ORDER BY ListPrice Desc
SQL Less Than or Equal To with Other Types
Here we’re returning products modified before February 15th, 2014.
SELECT ProductNumber, Name, ListPrice, ModifiedDate
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!
To learn more about SQL Less than or equal (<=), check out these useful resources: