s
sreelu 123

Posted on 28th February 2024|38 views

0
votes

Postgresql Generate Series

How to generate series in PostgreSQL?

Answers
P
kumar san

Posted on 28th February 2024

The [start],[stop] will generate and stop series and [increment] is used to increment the sequence by that value.

Syntax:

generate_series([start], [stop], [intervel/increment]);

Generate series in PostgreSQL can be used to build a set in column-wise with a regular incrementation as provided in the syntax.

For example:

SELECT * FROM generate_series(1[start], 15[Stop], 2[Increment]);

Now you run SQL you get,

OUTPUT:

1

3

5

7

9

11

13

15

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos