# Find the number of the longest continuously rising days for a stock

DevFeed: [Find the number of the longest continuously rising days for a stock](<https://devfeed.tech/articles/find-the-number-of-the-longest-continuously-rising-days-for-a-stock-34582.md>)

Original publisher: [Read original article](<https://tapoueh.org/blog/2018/02/find-the-number-of-the-longest-continuously-rising-days-for-a-stock/>)

Author: Dimitri Fontaine PostgreSQL Major Contributor; Author

Published: 2018-02-06T22:24:17Z

Content type: comparison

Language: en

Sources: [Dimitri Fontaine](<https://devfeed.tech/sources/dimitri-fontaine.md>)

Topics: [SQL](<https://devfeed.tech/topics/sql.md>), [Declarative programming](<https://devfeed.tech/topics/declarative-programming.md>), [Python](<https://devfeed.tech/topics/python.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [compare](<https://devfeed.tech/tags/compare.md>), [declarative](<https://devfeed.tech/tags/declarative.md>), [python](<https://devfeed.tech/tags/python.md>), [sql](<https://devfeed.tech/tags/sql.md>)

## AI overview

The article compares SQL and Python implementations for finding the longest continuously rising sequence of stock-market days and selecting the top 10 records from a billion-row dataset. It argues that SQL's difficulty in these cases is related to its declarative model and the need to understand the data model and business requirements.

## Source excerpt

Today I want to react to an article that claims that Relational Algebra Is the Root of SQL Problems in which the author hand-waves the following position: SQL becomes more a hindrance to data manipulation than an efficient tool. SQL's greatest problem isn't in the implementation level, but at its theory foundation. The problem can't be solved by application optimization. Relational algebra isn't sophisticated enough for handling the complicated data manipulation scenarios. Then they go on to several arguments from authority to "prove" their point. My reading of the article is that SQL is very hard when you didn't care to learn it, as most technologies are. In this article, we're going to look at the simple examples provided where apparently SQL makes it so much harder to find a solution compared to writing some Java or C++ code. Contrary to the original article, we go as far as to actually writing both the SQL solution and a complete Python solution, so that we can compare.