The detection and matching of predefined sequences of events in incoming, unbounded data streams is called Complex Event Processing (CEP).
CEP is like searching the desired pattern in a query window.
A common use case in real-time stream processing is the detection of predefined sequences of events over continuously-arriving data–data that is often out of order.
To expose CEP via SQL for instance, you can use MATCH_RECOGNIZE
A common (but historically complex) task in SQL day-to-day work is to identify meaningful sequences of events in a data set — also known as Complex Event Processing (CEP).