Predicates in SQL
Predicates are operations that test whether something is true or not. They can test the relationship between expressions or test for a characteristic of an expression. Row value expressions can also be used as operands to predicates where this makes sense.
SQL supports the following types of predicates:
• Comparison
– =, <>, <, >=, >, <=
– IS DISTINCT FROM
– BETWEEN
• Quantified comparison
– =ALL, <>ALL, <ALL, >=ALL, >ALL, <=ALL
– =ANY, <>ANY, <ANY, >=ANY, >ANY, <=ANY
• Pattern matching:
– LIKE
– BEGINNING, ENDING, CONTAINING
– SIMILAR TO
• Containment
– IN
• Existence
– EXISTS
• IS NULL
• IS INTEGER
• IS DECIMAL
• IS FLOAT
• IS TRUE, IS FALSE, IS UNKNOWN
• IS INGRESDATE
• IS ANSIDATE
• IS TIME
• IS TIMESTAMP
• IS INTERVAL YEAR TO MONTH
• IS INTERVAL DAY TO SECOND
• IS II_DATE_FORMAT
Note: The long data types (long varchar, long byte, and long nvarchar) cannot be used with predicates that need to inspect the content of data, such as to determine equality. The pattern-matching predicates can be used with long varchar and long nvarchar.
Last modified date: 04/03/2024