Table Employee has 10 records. It has a non-NULL SALARY column which is also UNIQUE.
The SQL statement
SELECT COUNT(*) FROM Employee WHERE SALARY > ANY (SELECT SALARY FROM EMPLOYEE);
prints
Select an option to see the answer and solution.
The SQL statement
SELECT SUBSTR('abcdefghij', INSTR('123321234', '2', 3, 2), 2) FROM DUAL;
prints
Select an option to see the answer and solution.
The SQL statement
SELECT ROUND(45.926, -1) FROM DUAL;
A. is illegal
B. prints garbage
C. prints 045.926
D. prints 50
Select an option to see the answer and solution.
Which of the following must be enclosed in double quotes?
A. Dates
B. Column Alias
C. Strings
D. All of the above
Select an option to see the answer and solution.
Which of the following command makes the updates performed by the transaction permanent in the database?
A. ROLLBACK
B. COMMIT
C. TRUNCATE
D. DELETE
Select an option to see the answer and solution.
Which command undo all the updates performed by the SQL in the transaction?
A. ROLLBACK
B. COMMIT
C. TRUNCATE
D. DELETE
Select an option to see the answer and solution.
Find all the cities whose humidity is 89, Table Name weather
A. SELECT city WHERE humidity = 89;
B. SELECT city FROM weather WHERE humidity = 89;
C. SELECT humidity = 89 FROM weather;
D. SELECT city FROM weather;
Select an option to see the answer and solution.
Find the temperature in increasing order of all cities, Table Name 'weather'
A. SELECT city FROM weather ORDER BY temperature;
B. SELECT city, temperature FROM weather;
C. SELECT city, temperature FROM weather ORDER BY temperature;
D. SELECT city, temperature FROM weather ORDER BY city;
Select an option to see the answer and solution.
What is the meaning of LIKE '%0%0%'
A. Feature begins with two 0's
B. Feature ends with two 0's
C. Feature has more than two 0's
D. Feature has two 0's in it, at any position
Select an option to see the answer and solution.
Find the names of these cities with temperature and condition whose condition is neither sunny nor cloudy
A. SELECT city, temperature, condition FROM weather WHERE condition NOT IN ('sunny', 'cloudy');
B. SELECT city, temperature, condition FROM weather WHERE condition NOT BETWEEN ('sunny', 'cloudy');
C. SELECT city, temperature, condition FROM weather WHERE condition IN ('sunny', 'cloudy');
D. SELECT city, temperature, condition FROM weather WHERE condition BETWEEN ('sunny', 'cloudy');
Select an option to see the answer and solution.
Find the name of those cities with temperature and condition whose condition is either sunny or cloudy but temperature must be greater than 70o F.
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;
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
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');
Select an option to see the answer and solution.
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;
Select an option to see the answer and solution.
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;
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
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')
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
Select an option to see the answer and solution.
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. Both A and B
E. Both A and C
Select an option to see the answer and solution.