You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: applied-overview-of-MATCH_RECOGNIZE-clause.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Applied overview of MATCH_RECOGNIZE clause
2
2
3
-
SQL MATCH_RECOGNIZE clause can perform Pattern Matching over a set of rows. MATCH_RECOGNIZE does this by assigning labels to events, finding the events within an ordered partition, and pulling out any sequences that match the given pattern
3
+
SQL `MATCH_RECOGNIZE` clause can perform Pattern Matching over a set of rows. `MATCH_RECOGNIZE` does this by assigning labels to events, finding the events within an ordered partition, and pulling out any sequences that match the given pattern
4
4
5
5
To demonstrate the power of `MATCH_RECOGNIZE` we will use the Unemployment by State data set from BLS.
6
6
@@ -15,9 +15,9 @@ Analysis Approach
15
15
We will use MATCH_RECOGNIZE to find the decreasing Unemployment Rate pattern PARTITIONed by State
16
16
Enter MATCH_RECOGNIZE
17
17
18
-
The MATCH_RECOGNIZE clause is used to search for a pattern in single field value spanning over multiple records. This clause enables you to define patterns using regular expressions and aggregate methods to verify and extract values from the match.
18
+
The `MATCH_RECOGNIZE` clause is used to search for a pattern in single field value spanning over multiple records. This clause enables you to define patterns using regular expressions and aggregate methods to verify and extract values from the match.
19
19
20
-
The following example shows the basic structure of a MATCH_RECOGNIZE clause:
20
+
The following example shows the basic structure of a `MATCH_RECOGNIZE` clause:
PARTITION BY allows the match to be keyed and partitioned over a column name. A match will happen over every unique key specified by the partition statement. This enables a single query to be matched over all the keys and generate separate matches, one to every key.
62
+
`PARTITION BY` allows the match to be keyed and partitioned over a column name. A match will happen over every unique key specified by the partition statement. This enables a single query to be matched over all the keys and generate separate matches, one to every key.
63
63
64
64
## MEASURES
65
65
66
-
MEASURES is used to define the projected values from the match using aggregate methods. For example, LAST(YEARMONTH) AS STREAK_END_DATE will output the last YEARMONTH value that was found over all events that matched pattern named DECREASE into field name STREAK_END_DATE.
66
+
`MEASURES` is used to define the projected values from the match using aggregate methods. For example, LAST(YEARMONTH) AS STREAK_END_DATE will output the last YEARMONTH value that was found over all events that matched pattern named DECREASE into field name STREAK_END_DATE.
67
67
68
68
## PATTERN
69
69
@@ -111,7 +111,7 @@ The following aggregate methods can be used in MEASURES and DEFINE:
111
111
112
112
## Query Output
113
113
114
-
The above MATCH_RECOGNIZE query will produce the following results, which show the States with a Streak decreasing Unemployment Rate.
114
+
The above `MATCH_RECOGNIZE` query will produce the following results, which show the States with a Streak decreasing Unemployment Rate.
115
115
Rhode Island has a decreasing Unemployment Rate start July 2021.
116
116
117
117
We see that Rhode Island has a decreasing Unemployment Rate starting July 2021.
0 commit comments