Skip to content
Advertisement

PostgreSQL DETECT age’s groups

Let’s consider a part of table like this:

The problem is to detect the age’s groups with step 10 years. It’s not a kind of problems like age’s groups assigning, like:

In this case the request must show something like

where MIN(age) = 1 and MAX(age) = 88. I’m currently working with PostgreSQL 12. Do you know any function or have any idea, how to do that?

Advertisement

Answer

How about just using string operations?

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement