I have several small questions and I wrote some simple examples to clarify them:
Will a nested aggregate take one value from from all groups? Like the minimal maximum of all groups? or the minimum count?
Select x, min(max(z)) From y Group by xOn the same note, is there any merit in doing the following to get the minimal count from all groups, or the second line is unnecessary?
select x, min(count(*)) select x, count(*) From y Group by xIf both are invalid, how would you do a query on all groups like taking the minimum of all maximums in each group?
Can you do a query inside a "from"?
Select x From y natural inner join (select z AS y from foo)Is it allowed to do
from *after agroup by?Select x From y Group by x Having avg(x) > (select * from * where x > 1)and if not, how would you do a query on each group after the
group by?
Note: this isn't some live version of SQL server, just old theoretical SQL.
selectkeywords without using a derived table or a sub-query. And 3) is a clear no. – Nov 24 '16 at 15:57group by? @a_horse_with_no_name – shinzou Nov 24 '16 at 16:06Select x, min(max(z)) From y Group by x) is not valid SQL but it runs in Oracle (and only there) without error. – ypercubeᵀᴹ Nov 24 '16 at 16:11select min(max(z)) from y group by xdoes indeed work in Oracle, but not the query shown – Nov 24 '16 at 16:59