Skip to content

Instantly share code, notes, and snippets.

@narusemotoki
Created March 12, 2018 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save narusemotoki/679e3e8cc2f10918a9cf52f6ef426ce9 to your computer and use it in GitHub Desktop.
Save narusemotoki/679e3e8cc2f10918a9cf52f6ef426ce9 to your computer and use it in GitHub Desktop.
フィボナッチSQL
WITH RECURSIVE fib (m, n) AS (
SELECT 1, 1
UNION ALL
SELECT n, m + n FROM fib
)
SELECT m FROM fib
LIMIT 10
;
m
----
1
1
2
3
5
8
13
21
34
55
(10 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment