0
0
PostgreSQLquery~10 mins

GENERATE_SERIES for sequence creation in PostgreSQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to generate a sequence of numbers from 1 to 5.

PostgreSQL
SELECT [1](1, 5);
Drag options to blanks, or click blank then click option'
ACREATE_SERIES
BGENERATE_SERIES
CSERIES_GENERATE
DMAKE_SERIES
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong function name like SERIES_GENERATE.
Trying to use CREATE_SERIES which does not exist.
2fill in blank
medium

Complete the code to generate a sequence from 10 to 50 with a step of 10.

PostgreSQL
SELECT * FROM GENERATE_SERIES(10, 50, [1]);
Drag options to blanks, or click blank then click option'
A5
B20
C15
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Using a step smaller or larger than 10 which changes the sequence.
Omitting the step argument.
3fill in blank
hard

Fix the error in the code to generate a sequence from 5 to 1 decreasing by 1.

PostgreSQL
SELECT * FROM GENERATE_SERIES(5, [1], -1);
Drag options to blanks, or click blank then click option'
A0
B6
C1
D-1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 as the end value which excludes 1.
Using a positive step with decreasing sequence.
4fill in blank
hard

Fill both blanks to generate a sequence of odd numbers from 1 to 9.

PostgreSQL
SELECT * FROM GENERATE_SERIES([1], [2], 2);
Drag options to blanks, or click blank then click option'
A1
B2
C9
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Using 2 as start which generates even numbers.
Using 10 as end which excludes 9.
5fill in blank
hard

Fill all three blanks to generate a sequence of letters from 'a' to 'e' using ASCII codes.

PostgreSQL
SELECT CHR([1] + i) FROM GENERATE_SERIES(0, [2], [3]) AS s(i);
Drag options to blanks, or click blank then click option'
A96
B4
C1
D97
Attempts:
3 left
💡 Hint
Common Mistakes
Using 96 as base, which gives '`' (96) for i=0 instead of 'a'.
Using wrong step or end value that misses letters.