MySQL Tutorial MySQL Advanced MySQL Database Account Management MySQL References

MySQL - Less than or equal to (<=) Operator



The MySQL <= (less than or equal to) operator checks if the value of left operand is less than or equal to the value of right operand and returns true if the condition is true, false otherwise.

Syntax

The syntax for using less than or equal to operator in MySQL is given below:

expression <= expression  

Parameters

expression Any valid expression. Both expressions must have implicitly convertible data types.

Example 1:

The example below shows the usage of less than or equal to operator:

mysql> SELECT 10 <= 10;
Result: 1

mysql> SELECT 10.0 <= 10;
Result: 1

mysql> SELECT 20 <= 10;
Result: 0

mysql> SELECT 'abc' <= 'abc';
Result: 1

mysql> SELECT 'xyz' <= 'abc';
Result: 0

Example 2:

Consider a database table called Employee with the following records:

EmpIDNameCityAgeSalary
1JohnLondon253000
2MarryNew York242750
3JoParis272800
4KimAmsterdam303100
5RameshNew Delhi283000
6HuangBeijing282800

To select records of table where Age of the person is less than or equal to 27, the query is given below.

SELECT * FROM Employee
WHERE Age <= 27;

The query will produce following result:

EmpIDNameCityAgeSalary
1JohnLondon253000
2MarryNew York242750
3JoParis272800

❮ MySQL Operators