SQL: Recursive Fibonacci

Medium
SQL — Advanced SQL CTE Recursion
Generate Fibonacci sequence using recursive CTE.

Constraints

Write standard SQL (MySQL 8.0 compatible).

Examples

Example 1:
Input: n=8
Output:
Example 2:
Input: n=8
Output:

Hints

WITH RECURSIVE.
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.