Skip to content
Advertisement

Group by from the elements of array in AWS Athena

I have a table which has two columns. The table has the following schema

The sample data is:

I want to group by the individual subject that is I want to count the number of subjects that all the students have taken. So my expected result is

I have heard about unnest an array, but not able to get this result.

How should I approach this?

Advertisement

Answer

I think you only need to unnest:

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