04pallav
9/13/2017 - 9:53 PM

Interesting Queries

Interesting Queries

1.

#See how ALL is used
#See We can refer to values in the outer SELECT within the inner SELECT

select continent,name,area from world x where area>= 
ALL (select area from world y where y.continent=x.continent and area>0) 

2. Getting the first element after groupby

select continent,min(name) from world group by continent