Category Archives: SQL

SQL Ex Ru: Question 25

It is a try. Not working.

SELECT distinct maker
from
(
SELECT distinct model, ram, speed, rank() over(order by ram asc, speed desc) as pos FROM PC
) AS A
inner join product B
ON A.model = B.model
where a.pos = 1

Advertisements

Leave a comment

Filed under SQL

SQL Ex Ru: Question 24

SELECT model FROM
(
SELECT model, Price, RANK() OVER(ORDER BY Price DESC) pos
FROM
(
SELECT model, price from PC where price = (select max(price) from PC)
UNION
SELECT model, price from Laptop where price = (select max(price) from Laptop)
UNION
SELECT model, price from Printer where price = (select max(price) from Printer)
) B
) A
WHERE pos = 1

Leave a comment

Filed under SQL