Skip to content
Advertisement

SQL statement about average

My question is -> Retrieve the segment ID and length of each segment that is longer than the average length of all segments. Name the column indicating the length of segments “Length”.

Relations:

What I got so far is:

And I got this error message:

Error: Your query has syntax errors. Description: java.sql.SQLException: ORA-00979: not a GROUP BY expression

Can anyone say what’s exactly wrong ?

Advertisement

Answer

You can use window functions to achieve this:

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