Vidyalelo
SQL · Q32

SQL

Programming · SQL · question 32

Q32

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

A.
SELECT * FROM weather WHERE temperature > (SELECT temperature FROM weather WHERE city = 'Paris')
Answer
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

Answer: Option A
Solution:
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.