NexusDB V3 Manual
Like Predicate
|
|
NexusDB Manual V3 > SQL Reference > Predicates
|
Specify a pattern-match comparison.
Syntax
<like predicate> ::=
<character like predicate part 2> ::=
<character pattern> ::= <character value expression>
Notes
§
|
The data types of the row value predicand, character pattern and escape-character shall be comparable character string types.
|
§
|
The predicate evaluates to TRUE if the row value predicand string matches the character pattern string, else to FALSE.
|
§
|
Underscore ( _ ) is used as a wildcard character representing an arbitrary single character specifier at the location in character pattern.
|
§
|
Percent ( % ) is used as a wildcard character representing an arbitrary string specifier at the location in character pattern.
|
§
|
The ESCAPE clause causes the character following the escape-character to be treated as a normal character, which allows the special wildcard characters to be used as single character specifiers in character pattern.
|
§
|
If any of the row value predicand, character pattern or escape-character values are null, then the predicate evaluates to UNKNOWN.
|
§
|
The NOT operator inverts the meaning of the comparison and is equal to:
|
NOT ( <row value predicand> LIKE <character pattern> [ ESCAPE escape-character ] )
§
|
IGNORE CASE makes the comparison operation case-insensitive.
|
Examples
1)
|
The following example selects students whose first name starts with 'Jo':
|
SELECT studentName, gender
FROM students
WHERE studentName LIKE 'Jo%'
2)
|
The following example selects students whose first name has an 'o' in the second position:
|
SELECT studentName, gender
FROM students
WHERE studentName LIKE '_o%'
3)
|
The following example selects orders with '10%' as a portion of the notes column value:
|
SELECT orderID, notes
FROM orders
WHERE notes LIKE '%10\%%' ESCAPE '\'
Conformance
SQL:2003 standard
NexusDB extensions
|
-
-
-
|
Core SQL
Feature F281 "LIKE enhancements"
IGNORE CASE
|
|
© Nexus Database Systems Pty Ltd.