From the course: PostgreSQL: Advanced Queries

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Define WHERE criteria with a series

Define WHERE criteria with a series - PostgreSQL Tutorial

From the course: PostgreSQL: Advanced Queries

Define WHERE criteria with a series

- [Instructor] PostgreSQL can create a list of sequential numbers with the generate_series function. You can customize the starting and ending number as well as the interval that numbers will be created. For example, we'll select generate_series and inside we have a couple of options. The first number is the number the series will start with. Let's start with 100. The second value is the ending number, and I'll make a series that goes up to 120. The results of this query will list out all the numbers between 100 at the top and 120 at the very bottom. You can also add in an optional third parameter to control an interval. After 120, I'll type in comma 5. This will create a series that will range from 100 to 120 but only includes every fifth number. Now right now, I'm treating the generate_series function as a column with no table. But you can also treat it as a table with a single column. You might see the same function…

Contents