Sql Server(Computer Science ) Questions and Answers
Question 1. The UPDATE SQL clause can _____________
update only one row at a time
update more than one row at a time
delete more than one row at a time
delete only one row at a time
Explanation:-
Answer: Option B. -> update more than one row at a time
Question 2. Find the names of these cities with temperature and condition whose condition is neither sunny nor cloudy
SELECT city, temperature, condition FROM weather WHERE condition NOT IN (‘sunny’, ‘cloudy’)
SELECT city, temperature, condition FROM weather WHERE condition NOT BETWEEN (‘sunny’, ‘cloudy’)
SELECT city, temperature, condition FROM weather WHERE condition IN (‘sunny’, ‘cloudy’)
SELECT city, temperature, condition FROM weather WHERE condition BETWEEN (‘sunny’, ‘cloudy’);
Explanation:-
Answer: Option A. -> SELECT city, temperature, condition FROM weather WHERE condition NOT IN (‘sunny’, ‘cloudy’)
Question 3. SQL query to find the temperature in increasing order of all cities
SELECT city FROM weather ORDER BY temperature
SELECT city, temperature FROM weather
SELECT city, temperature FROM weather ORDER BY temperature
SELECT city, temperature FROM weather ORDER BY city
Explanation:-
Answer: Option D. -> SELECT city, temperature FROM weather ORDER BY city
Question 4. 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 > 70
SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ OR temperature > 70
SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ AND temperature > 70
SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ AND temperature > 70
Explanation:-
Answer: Option C. -> SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ AND temperature > 70
Question 5. Which SQL statement is used to insert new data in a database?
Insert Into
Add New
Insert Record
Add Record
Explanation:-
Answer: Option A. -> Insert Into
Question 6. What is the correct order of clauses in a SQL statement?
SELECT, FROM, ORDER BY, WHERE
SELECT, FROM, WHERE, ORDER BY
SELECT, WHERE, FROM, ORDER BY
WHERE, FROM, SELECT, ORDER BY
Explanation:-
Answer: Option B. -> SELECT, FROM, WHERE, ORDER BY
Question 7. In sql the spaces at the end of the string are removed by
LTrim
Upper
Trim
Lower
Explanation:-
Answer: Option C. -> Trim
Question 8. Which of the following statements is true concerning subqueries?
Does not start with the word SELECT.
Involves the use of an inner and outer query.
Cannot return the same result as a query that is not a subquery.
All of the above
Explanation:-
Answer: Option B. -> Involves the use of an inner and outer query.