SQL> desc tab1
Name Null? Type
----------------------------------------- -------- ----------------------------
ID NUMBER
NAME VARCHAR2(1000)
SQL> select * from tab1;
ID NAME
---------- ---------------
1 a
2 b
3 c
SQL> select * from tab1 where id > AVG(id);
select * from tab1 where id > AVG(id)
*
ERROR at line 1:
ORA-00934: group function is not allowed here
SQL>
The error is very clear and says that this cannot be done. But I don't see why. The query makes perfect sense:
select all rows from
tab1
whoseid
value is greater than the average