Complete the code to generate a sequence of numbers from 1 to 5.
SELECT [1](1, 5);
The GENERATE_SERIES function creates a sequence of numbers between the start and end values.
Complete the code to generate a sequence from 10 to 50 with a step of 10.
SELECT * FROM GENERATE_SERIES(10, 50, [1]);
The third argument in GENERATE_SERIES is the step size. Here, 10 means the sequence increases by 10 each time.
Fix the error in the code to generate a sequence from 5 to 1 decreasing by 1.
SELECT * FROM GENERATE_SERIES(5, [1], -1);
To generate a decreasing sequence from 5 down to 1, the end value must be 1, and the step is -1.
Fill both blanks to generate a sequence of odd numbers from 1 to 9.
SELECT * FROM GENERATE_SERIES([1], [2], 2);
The sequence starts at 1 and ends at 9 with a step of 2 to get odd numbers.
Fill all three blanks to generate a sequence of letters from 'a' to 'e' using ASCII codes.
SELECT CHR([1] + i) FROM GENERATE_SERIES(0, [2], [3]) AS s(i);
ASCII code for 'a' is 97, so use 97 as base. The series goes from 0 to 4 with step 1 to get letters 'a' (97+0) to 'e' (97+4=101).