I am running into some difficulty with the following query.
SELECT maker, speed
FROM
(
SELECT *
FROM product
NATURAL JOIN laptop
)
WHERE hd > 30;
I am trying to find the maker and speed of laptops with hard drives greater than 30 gigabytes.
I have two relations laptops and products. Laptops has the tuples (maker, model, type) and laptop has the tuples (model, speed, ram, hd, screen, and price).
What I think I am doing.
- Joining product with laptop with natural join, which I think and does
(when submitted by itself) give me a relation of laptop but with two
more columns maker and type. - I then am trying to just select maker and speed from that table where
the size of the hd is greater than 30.
A subquery in the
FROMclause requires a table alias:From the docs:
However for your example, the subquery isn’t needed at all.
Note that
NATURAL JOINs are not usually recommended, and it is best to be explicit about the columns joined in anONclause.