Created
May 13, 2015 04:45
-
-
Save hden/a7519d5797b5498b52f2 to your computer and use it in GitHub Desktop.
Fibonacci numbers with SQLite
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
-- http://www.sqlite.org/lang_with.html -- | |
WITH RECURSIVE | |
fib(current, next) AS ( | |
SELECT 0 current, 1 next | |
UNION ALL | |
SELECT fib.next current, fib.current + fib.next next | |
FROM fib | |
LIMIT 20 | |
) | |
SELECT current FROM fib | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment