Where expression is any valid sql expression. Both expression must have implicitly convertible data types. Not less than operator returns boolean value TRUE or FALSE.
SELECT ComparedPrice =
CASE
WHEN SoldPrice !< ActualPrice THEN 'SoldPrice is not less than ActualPrice of ' + ProductName
ELSE 'SoldPrice can be less than or equal to ActualPrice of ' + ProductName
END
SoldPrice is not less than ActualPrice of Chai
SoldPrice can be less than or equal to ActualPrice of Chang
SoldPrice is not less than ActualPrice of Aniseed Syrup
SoldPrice is not less than ActualPrice of Chef Anton's Cajun Seasoning
SoldPrice can be less than or equal to ActualPrice of Chef Anton's Gumbo Mix
Above example describes use of not less than operator to compare SoldPrice and ActualPrice field values of table.
Example 2 : Comparing value of two variables.
DECLARE @Unit1 INT, @Unit2 int
SET @Unit1 = 20
SET @Unit2 = 10
IF(@Unit1 !< @Unit2)
BEGIN
PRINT 'Unit1 is not less than Unit2.'
END
ELSE
BEGIN
PRINT 'Unit1 is less than or equal to Unit2.'
END
Output
Unit1 is not less than Unit2.
Above example explains use of not less than comparison operator to compare two variables.
Example 3 : Use of not less than operator in select query.
DECLARE @Unit1 INT, @Unit2 INT
SET @Unit1 = 20
SET @Unit2 = 10
SELECT Message =
CASE
WHEN @Unit1 !< @Unit2 THEN 'Unit1 is not less than Unit2.'
ELSE 'Unit1 is less than or equal to Unit2.'
END
Output
Message
Unit1 is not less than Unit2.
Above example describes use of not less than comparison operator in sql query. We can use not less than operator in select query to compare variable or fields of table.