PostgreSQL - NOT BETWEEN operator Last Updated : 19 Sep, 2023 Comments Improve Suggest changes Like Article Like Report PostgreSQL NOT BETWEEN operator is used to match all values against a range of values excluding the values in the mentioned range itself. Syntax: value NOT BETWEEN low AND high; Or, Syntax: value < low OR value > high; The NOT BETWEEN operator is used generally with WHERE clause with association with SELECT, INSERT, UPDATE or DELETE statement. For the sake of this article we will be using the sample DVD rental database, which is explained here. Example 1: Here we will query for the payment whose amount is not between 3 USD and 5 USD, using the NOT BETWEEN operator in the "Payment" table of our sample database. SELECT customer_id, payment_id, amount FROM payment WHERE amount NOT BETWEEN 3 AND 5; Output: Example 2: Here we will query for getting the payment whose payment date is not between 2007-03-07 and 2007-03-29 using the BETWEEN operator in the "Payment" table of our sample database. SELECT customer_id, payment_id, amount, payment_date FROM payment WHERE payment_date NOT BETWEEN '2007-03-07' AND '2007-03-29'; Output: Note: While making date queries the literal date in ISO 8601 format i.e., YYYY-MM-DD should be used in PostgreSQL. Comment More infoAdvertise with us Next Article PostgreSQL - NOT BETWEEN operator R RajuKumar19 Follow Improve Article Tags : Misc Python postgreSQL-operators Practice Tags : Miscpython Similar Reads PostgreSQL - BETWEEN Operator The PostgreSQL BETWEEN operator is an essential tool for filtering data within a specific range. Often used in the WHERE clause of SELECT, INSERT, UPDATE, and DELETE statements, this operator simplifies range-based conditions, making queries faster and easier to read. In this article, we will explai 3 min read PostgreSQL - NOT IN operator PostgreSQL NOT IN condition is a powerful tool for data retrieval in PostgreSQL by allowing users to filter out specific values from their query results. This condition is particularly useful when we want to exclude a defined set of values from a dataset by making our queries more efficient and targ 4 min read PostgreSQL - NOT LIKE operator The PostgreSQL NOT LIKE operator is a powerful tool used in SQL queries to filter out rows that do not match specific patterns. By utilizing this operator, users can eliminate undesired string patterns from their results, enabling more precise data retrieval. It is particularly beneficial in scenari 3 min read PostgreSQL - EXCEPT Operator In PostgreSQL, the EXCEPT operator is a powerful tool used to return distinct rows from the first query that are not present in the output of the second query. This operator is useful when you need to compare result sets of two or more queries and find the differences.Let us better understand the EX 3 min read PostgreSQL - IN operator The IN operator in PostgreSQL is a powerful and efficient tool used to filter records based on a predefined set of values. When used with the WHERE clause, it simplifies SQL queries and enhances readability, making it a key component of SQL query optimization for data retrieval and database manipula 4 min read Like