PostgreSQL Fibonacci

04 April 2014

Earlier today I was researching whether it was possible to generate Fibonacci numbers using a SQL query. A Google search turned up a short PostgreSQL query that uses a recursive approach. Since this is recursion, the query starts by defining a base case and then goes on to define a generation step with a stopping limit.

It’s interesting to see the edge features of a language and I find that query languages tend to have the most striking ones. My experience with the various SQLs has been that at the basic level they’re very similar but diverge significantly at the edges.