Knowee
Questions
Features
Study Tools

Find the name of those cities with temperature and condition whose condition is either sunny or cloudy but temperature must be greater than 70.SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ OR temperature > 70SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ AND temperature > 70SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ AND temperature > 70SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ OR temperature > 70

Question

Find the name of those cities with temperature and condition whose condition is either sunny or cloudy but temperature must be greater than 70.SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ OR temperature > 70SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ AND temperature > 70SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ AND temperature > 70SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ OR temperature > 70

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

The correct SQL query to find the name of cities with temperature greater than 70 and condition either sunny or cloudy would be:

SELECT city, temperature, condition 
FROM weather 
WHERE (condition = 'sunny' OR condition = 'cloudy') AND temperature > 70

This query will select the city, temperature, and condition from the weather table where the condition is either sunny or cloudy and the temperature is greater than 70. The parentheses are used to ensure that the OR condition is evaluated first, then the AND condition. Without the parentheses, the query might not return the expected results due to the precedence of AND over OR in SQL.

This problem has been solved

Similar Questions

Find the cities name with the condition and temperature from table 'whether' where condition = rainy or cold but temperature >= 30.Select one:a. SELECT city, temperature, condition FROM weather WHERE condition = 'rainy' OR condition = 'cold' AND temperature >= 30b. SELECT city, temperature, condition FROM weather WHERE condition = 'rainy' AND condition = 'cold' OR temperature >= 30c. SELECT city, temperature, condition FROM weather WHERE condition = 'rainy' OR condition = 'cold' OR temperature >= 30d. SELECT city, temperature, condition FROM weather WHERE condition = 'rainy' AND condition = 'cold' AND temperature >= 30

Find the names of cities with all entries whose temperature is in the range of 71 and 89SELECT * FROM weather WHERE temperature NOT IN (71 to 89);SELECT * FROM weather WHERE temperature NOT IN (71 and 89);SELECT * FROM weather WHERE temperature NOT BETWEEN 71 to 89;SELECT * FROM weather WHERE temperature BETWEEN 71 AND 89;

Find all the tuples having temperature greater than ‘Paris’.SELECT * FROM weather WHERE temperature > (SELECT temperature FROM weather WHERE city = ‘Paris’SELECT * FROM weather WHERE temperature > (SELECT * FROM weather WHERE city = ‘Paris’)SELECT * FROM weather WHERE temperature > (SELECT city FROM weather WHERE city = ‘Paris’)SELECT * FROM weather WHERE temperature > ‘Paris’ temperature

Find the names of the countries whose condition is sunny.SELECT country FROM location WHERE condition = 'sunny';SELECT country FROM location WHERE city IN (SELECT city FROM weather WHERE condition = 'sunny');SELECT country FROM location WHERE city NOT IN (SELECT city FROM weather WHERE condition = 'sunny');SELECT country FROM location WHERE city UNION (SELECT city FROM weather WHERE condition = 'sunny');

Find all the cities whose humidity is 89SELECT city WHERE humidity = 89;SELECT city FROM weather WHERE humidity = 89;SELECT humidity = 89 FROM weather;SELECT city FROM weather;

1/2

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.