"Select *" by is ok but not "Group By *"

Greetings!

Why does Oracle allow select * to display all fields/columns but does not allow group by * to group the result by all columns? The logic engine could use the same logic as it is using for select *.

Select * returns ALL columns from a table.

Group by has to specify the list of columns that an aggregate function is being applied to.

So,

select a,b,count(*) from table

where …

group by a,b;

You would not include the count(*) in the group by list.

I assume you imagine that Oracle should be able to determine which column is an aggregate and to ignore those? There can be more than one aggregated column of course.

It’s just how it is. :slight_smile:

Cheers,

Norm. [TeamT]

Sent from my Android device with K-9 Mail. Please excuse my brevity.

In addition, the logic for a select * involves reading the dictionary to retrieve a list of all the columns in the database table. The group by, using the same logic, would have to group by the same list of columns, and that would nnot give the expected results.

Cheers,

Norm. [TeamT]

Sent from my Android device with K-9 Mail. Please excuse my brevity.

Thank you Norm. Yes, you are correct about my assumption. I guess I should accept the fact that it is owned by Oracle & they can do what they want with it.