Quote (carteblanche @ Nov 20 2014 06:08pm)
oddly, i found documentation in oracle for ALL as well. i guess i learned something new.
i would go for the join as well. just be careful that if two countries in the same continent have the same area, they'll both be shown. if requirements are fine, leave it be.
are you still unclear about how the answer's query works? the link i posted was pretty clear and included examples. for each continent, it's grabbing all countries which have areas >= countries in the same continent. the only countries that satisfies that are the ones with the largest area. i can try to go into more detail if you need.
Haha, glad to hear you learned something
I understand how the provided answer works, I just wouldn't go about solving the problem as such.
But I am under the impression the way I am approaching these sorts of queries is disadvantageous, as I am struggling with all of the sample questions.
For example, I cannot solve question 8 on the same website.
Or well, actually, I did get it, but it took way too long.
Code
Select w.name, w.continent
From
world w inner join
(
Select a.name, 3*max(b.population) as 3xMax
From
world a
Inner Join world b
On a.continent = b.continent
Where a.name <> b.name
Group by a.name
) as wj
on w.name = wj.name
Where w.population > 3xMax
especially when this works:
Code
select
a.name, a.continent
from world as a
where
a.population >
(
select 3*max(b.population)
from world as b
where b.continent = a.continent and b.name <> a.name
)
Maybe I just need more practice.
This post was edited by MidnightRider on Nov 20 2014 05:19pm