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 PostgreSQL - ANY Operator The ANY operator in PostgreSQL is a powerful tool for comparing a scalar value against a set of values returned by a subquery. From this article, we can better understand the ANY Operator in PostgreSQL.Syntaxexpression operator ANY(subquery)Rules of ANY Operator The below rules must be followed whil 3 min read PostgreSQL - EXISTS Operator The EXISTS operator in PostgreSQL is a powerful SQL feature used to check the existence of rows in a subquery. It is particularly useful when working with correlated subqueries, where the inner query depends on values from the outer query. The EXISTS operator returns true if the subquery returns at 4 min read PostgreSQL - IS NULL operator The PostgreSQL IS NULL operator is used to check whether a value is NULL. In the context of databases, NULL indicates that data is either missing or not applicable. Since NULL cannot be compared directly with any integer or string (as such comparisons result in NULL, meaning an unknown result), the 2 min read PostgreSQL - LIKE operator In PostgreSQL, the LIKE operator is an essential tool for pattern matching in SQL queries. Whether we're dealing with large datasets or searching for specific string patterns, this operator provides a powerful way to filter and retrieve data based on partial matches. By Using wildcard search techniq 5 min read PostgreSQL - ALL Operator The PostgreSQL ALL operator is a powerful tool for comparing a value with a list of values returned by a subquery. This operator is essential for filtering and querying data based on comparisons with multiple values, making it a valuable addition to any PostgreSQL user's toolkit.Let us better unders 3 min read Like