Can smn explain me how this query works without FROM, having just SELECT here:
select code, speed, ram, price, screen
from laptop where exists (
select 1 x
from (
select v, rank()over(order by v) rn
from ( select cast(speed as float) sp, cast(ram as float) rm,
cast(price as float) pr, cast(screen as float) sc
)l unpivot(v for c in (sp, rm, pr, sc))u
)l pivot(max(v) for rn in ([1],[2],[3],[4]))p
where [1]*2 <= [2] and [2]*2 <= [3] and [3]*2 <= [4]
)
This is the answer for this task :
From the Laptop table, select rows fulfilling the following condition:
the values of the speed, ram, price, and screen columns can be arranged in such a way that each successive value exceeds two or more times the previous one.
Note: all known laptop characteristics are greater than zero.
Output: code, speed, ram, price, screen.