Examveda
Examveda

Find all the tuples having temperature greater than 'Paris'.

A. SELECT * FROM weather WHERE temperature > (SELECT temperature FROM weather WHERE city = 'Paris')

B. SELECT * FROM weather WHERE temperature > (SELECT * FROM weather WHERE city = 'Paris')

C. SELECT * FROM weather WHERE temperature > (SELECT city FROM weather WHERE city = 'Paris')

D. SELECT * FROM weather WHERE temperature > 'Paris' temperature

Answer: Option A

Solution(By Examveda Team)

To find all the tuples (rows) in the "weather" table where the temperature is greater than the temperature in Paris, you should use the SQL query SELECT * FROM weather WHERE temperature > (SELECT temperature FROM weather WHERE city = 'Paris') (Option A). This query correctly uses a subquery to first select the temperature in Paris and then compares it with the temperatures in other cities. If the temperature in a city is greater than that of Paris, the row is included in the result set. This is why Option A is the correct choice.

This Question Belongs to SQL >> Sql Miscellaneous

Join The Discussion

Comments ( 3 )

  1. Naveena Jakka
    Naveena Jakka :
    2 years ago

    Here the temperature is not mentioned directly but mentioned it's a city so first, we should write a subquery to select the temperature of Paris and then we should compare it to the other cities' temperatures to get the resultant tuples.....Thank you

  2. BIBEK NIROULA
    BIBEK NIROULA :
    2 years ago

    detail please

  3. Suraj Shrestha
    Suraj Shrestha :
    6 years ago

    how

Related Questions on Sql Miscellaneous