PostgreSQL – <= Operator

The less than or equal to operator is denoted by <=. This operator is used to compare two values and returns true if the left operand is less than or equal to the right operand; otherwise, it returns false.

Here’s the general syntax of using the less than or equal to operator in PostgreSQL:

value1 <= value2

For example, if you have a table named prices with columns product_id and price, and you want to retrieve all records where the price is less than or equal to $50, you would use the following SQL query:

SELECT * FROM prices WHERE price <= 50;

This query would fetch all rows from the prices table where the price column has a value of $50 or lower.

As with other comparison operators, the <= operator can be used with various data types, including numeric, date, and timestamp types, as long as the comparison makes sense for the given data types.

Similar Posts