A Symbol is a label or identifier that identifies a row in the Pattern and Result arguments. A Symbol can be any valid identifier (that is, a sequence of characters and digits that begins with a character) but is typically one or two uppercase letters. Symbols are case-insensitive; that is, 'SU' is identical to 'su', and the system reports an error if you use both.
For example, suppose that you have this input table:
record | city | temp | rh | cloudcover | windspeed | winddirection | rained_next_day |
---|---|---|---|---|---|---|---|
1 | Tuscson | 81 | 30 | 0.0 | 5 | NW | 1 |
2 | Tempe | 76 | 40 | 0.2 | 15 | NE | 0 |
3 | Tuscson | 70 | 70 | 0.4 | 10 | N | 0 |
4 | Tusayan | 75 | 50 | 0.4 | 5 | NW | 0 |
This table has examples of symbol definitions and the rows of the table that they match in NONOVERLAPPING mode:
Symbol Definition | Rows Matched |
---|---|
temp >= 80 AS H | 1 |
winddirection = 'NW' AS NW | 1, 4 |
winddirection = 'NW' OR windspeed > 12 AS W | 1, 2, 4 |
cloudcover != 0.0 AND rh > 35 AS C | 2, 3, 4 (An alternative to != is <>.) |
'true' AS A | 1, 2, 3, 4 This symbol definition matches all rows, for any input table. |
city like 'tu%' AS TU | None The like operator is case-sensitive. The % operator matches any number of characters. |
city not like 'tu%' AS TU | None |
city ilike 'tu%' AS TU | 1, 3, 4 The ilike operator is case-insensitive. |
city not ilike 'tu%' AS N | 2 |
city ilike 'tu%n' as T | 1, 3, 4 The % operator matches any number of characters. |
city ilike 'tu___n' as T | 1, 3 The underscore (_) operator matches any single character. The pattern 'tu___n' has three underscores, so it matches 'Tucson' but not 'Tusayan'. |
Rows with NULL values do not match any symbol. That is, the function ignores rows with missing values.