SQL MCQ Questions and answers – 04 Posted on June 17, 2020June 19, 2020 by admin 1 Created on June 17, 2020 By admin SQL MCQ Questions and answers - 04 1 / 10 1. Find the name of those cities with temperature and condition whose condition is either sunny or cloudy but temperature must be greater than 70oF. A. SELECT city, temperature, condition FROM weather WHERE condition = 'sunny' AND condition = 'cloudy' OR temperature > 70; B. SELECT city, temperature, condition FROM weather WHERE condition = 'sunny' OR condition = 'cloudy' OR temperature > 70; C. SELECT city, temperature, condition FROM weather WHERE condition = 'sunny' OR condition = 'cloudy' AND temperature > 70; D. SELECT city, temperature, condition FROM weather WHERE condition = 'sunny' AND condition = 'cloudy' AND temperature > 70; 2 / 10 2. 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 3 / 10 3. Find all the cities with temperature, condition and humidity whose humidity is in the range of 63 to 79 A. SELECT * FROM weather WHERE humidity IN (63 to 79) B. SELECT * FROM weather WHERE humidity NOT IN (63 AND 79) C. SELECT * FROM weather WHERE humidity BETWEEN 63 AND 79 D. SELECT * FROM weather WHERE humidity NOT BETWEEN 63 AND 79 4 / 10 4. Find the names of the countries whose condition is sunny. A. SELECT country FROM location WHERE condition = 'sunny'; B. SELECT country FROM location WHERE city IN (SELECT city FROM weather WHERE condition = sunny'); C. SELECT country FROM location WHERE city NOT IN (SELECT city FROM weather WHERE condition = 'sunny'); D. SELECT country FROM location WHERE city UNION (SELECT city FROM weather WHERE condition = 'sunny'); 5 / 10 5. Find the name of all cities with their temperature, humidity and countries. A. SELECT city, temperature, humidity, country FROM location; B. SELECT weather.city, temperature, humidity, country FROM weather, location; C. SELECT weather.city, temperature, humidity, country FROM weather, location WHERE weather.city = location.city; D. SELECT weather.city, temperature, humidity FROM weather SELECT country FROM location WHERE weather.city = location.city; 6 / 10 6. Find the name of cities with all entries whose temperature is in the range of 71 and 89 A. SELECT * FROM weather WHERE temperature NOT IN (71 to 89); B. SELECT * FROM weather WHERE temperature NOT IN (71 and 89); C. SELECT * FROM weather WHERE temperature NOT BETWEEN 71 to 89; D. SELECT * FROM weather WHERE temperature BETWEEN 71 AND 89; 7 / 10 7. Which of the following query finds the names of the sailors who have reserved at least one boat? A. SELECT DISTINCT s.sname FROM sailors s, reserves r WHERE s.sid = r.sid; B. SELECT s.sname FROM sailors s, reserves r WHERE s.sid = r.sid; C. SELECT DISTINCT s.sname FROM sailors, reserves WHERE s.sid = r.sid; D. None of These 8 / 10 8. Which of the following query finds colors of boats reserved by "Dustin"? A. SELECT DISTINCT b.color FROM boats b, sailors s WHERE s.sname = 'Dustin' AND s.sid = b.sid B. SELECT DISTINCT b.color FROM boats b, reserves r, sailors s WHERE s.sname = 'Dustin' AND s.sid = r.sid AND r.bid = b.bid; C. SELECT DISTINCT b.color FROM boats b, reserves r, sailors s WHERE s.sname = 'Dustin' AND s.sid = r.sid D. SELECT DISTINCT b.color FROM boats b, reserves r, sailors s WHERE s.sname = 'Dustin' AND r.bid = b.bid 9 / 10 9. What does the following query find?(SELECT DISTINCT r.sidFROM boats b, reserves rWHERE b.bid = r.bidAND b.color = 'red')MINUS(SELECT DISTINCT r.sidFROM boats b, reserves rWHERE b.bid = r.bidAND b.color = 'green') A. Find the sailor IDs of all sailors who have reserved red boats but not green boats B. Find the sailor IDs of at least one sailor who have reserved red boats but not green boats C. Find the sailor Ids of atmost one sailor who have reserved red boats but not green boats D. None of These 10 / 10 10. Which of the following query finds the name of the sailors who have reserved at least two boats? A. SELECT DISTINCT s.sname FROM sailors s, reserves r1, reserves r2 WHERE s.sid = r1.sid AND r1.sid = r2.sid AND r1.bid ≠ r2.bid B. SELECT DISTINCT s.sname FROM sailors s, reserves r1, reserves r2 WHERE s.sid = r1.sid AND COUNT(r1.bid) > r2.bid C. SELECT DISTINCT s.sname FROM sailors s, reserves r1, reserves r2 WHERE s.sid = r1.sid AND r1.sid = r2.sid AND r1.bid <> r2.bid D. All of these Your score is The average score is 40% LinkedIn Facebook Twitter 0% Restart quiz