Analyze stock candlestick charts and detect suspicious bank transfers

In the previous article, we learned how to use the ranking window function to achieve product classification and ranking, and to use the value window function to perform a ring/year-on-year analysis of sales.

In this article, we introduce a new feature of the SQL:2016 standard: Row Pattern Recognition.

Line pattern recognition

Row pattern recognition is used to find the pattern between multiple rows of data. Row pattern recognition finds a set of data rows that match the pattern by specifying a pattern (regular expression); and can filter, group, and aggregate these matched sets of data . Line pattern recognition can be used to analyze various time series data, such as stock market data analysis, financial fraud detection, or system event log analysis.

Row pattern recognition is used to find the rules between multiple rows of data, and it is a different concept from the LIKE pattern matching in the query condition.

Currently only Oracle 12c implements this function, so the examples in this article only support Oracle databases. The sample tables and data (stock and bank.sql) used in this article can be downloaded from GitHub .

Analyze stock charts

The following is a purely fictitious stock graph:

stock

The data comes from the stock price list (stock) in the sample script,

Guess you like

Origin blog.csdn.net/horses/article/details/108729092