CSE :: SQL Basics
- Find the name of those cities with temperature and condition whose condition is either sunny or cloudy but temperature must be greater than 70oF.
- Find all the tuples having temperature greater than 'Paris'.
- Find all the cities with temperature, condition and humidity whose humidity is in the range of 63 to 79
- Find the names of the countries whose condition is sunny.
- Find the name of all cities with their temperature, humidity and countries.
- Find the name of cities with all entries whose temperature is in the range of 71 and 89
- Which of the following query finds the names of the sailors who have reserved at least one boat?
- Which of the following query finds colors of boats reserved by "Dustin"?
-
What does the following query find?
(SELECT DISTINCT r.sid
FROM boats b, reserves r
WHERE b.bid = r.bid
AND b.color = 'red')
MINUS
(SELECT DISTINCT r.sid
FROM boats b, reserves r
WHERE b.bid = r.bid
AND b.color = 'green') - Which of the following query finds the name of the sailors who have reserved at least two boats?
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; |
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 |
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'); |
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; |
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 |
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 |