Last active
April 28, 2016 11:11
-
-
Save rivalitaet/4174bd286b45b51ec564d1a6cf5c759b to your computer and use it in GitHub Desktop.
Creates fibonacci numbers directly in postgreSQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH RECURSIVE fibs(val, tmp) as ( | |
SELECT 1::NUMERIC, 1::NUMERIC UNION ALL | |
SELECT tmp, val + tmp FROM fibs | |
) | |
SELECT val FROM fibs limit 100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment