The SQL Less Than 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 or equal to by using <=.
Here are a couple of examples:
|10 < 5||FALSE|
|5 < 20||TRUE|
|10 < 10||FALSE|
Here is an example using SQL Less than comparison operator to find all products with a ListPrice under $100.00
Only rows having a list prices less than $100.00 are included in the result. Now try it for your self!
SELECT ProductNumber, Name, ListPrice From Production.Product Where ListPrice < 100
SQL Less Than with Other Types
You can use the Less than 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'
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 Less than (<), check out these useful resources: