Sql Server(Computer Science ) Questions and Answers

Question 1. The UPDATE SQL clause can _____________
  1.    update only one row at a time
  2.    update more than one row at a time
  3.    delete more than one row at a time
  4.    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
  1.    SELECT city, temperature, condition FROM weather WHERE condition NOT IN (‘sunny’, ‘cloudy’)
  2.    SELECT city, temperature, condition FROM weather WHERE condition NOT BETWEEN (‘sunny’, ‘cloudy’)
  3.    SELECT city, temperature, condition FROM weather WHERE condition IN (‘sunny’, ‘cloudy’)
  4.    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
  1.    SELECT city FROM weather ORDER BY temperature
  2.    SELECT city, temperature FROM weather
  3.    SELECT city, temperature FROM weather ORDER BY temperature
  4.    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
  1.    SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ OR temperature > 70
  2.    SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ OR temperature > 70
  3.    SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ AND temperature > 70
  4.    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?
  1.    Insert Into
  2.    Add New
  3.    Insert Record
  4.    Add Record
Explanation:-
Answer: Option A. -> Insert Into

Question 6. What is the correct order of clauses in a SQL statement?
  1.    SELECT, FROM, ORDER BY, WHERE
  2.    SELECT, FROM, WHERE, ORDER BY
  3.    SELECT, WHERE, FROM, ORDER BY
  4.    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
  1.    LTrim
  2.    Upper
  3.    Trim
  4.    Lower
Explanation:-
Answer: Option C. -> Trim

Question 8. Which of the following statements is true concerning subqueries?
  1.    Does not start with the word SELECT.
  2.    Involves the use of an inner and outer query.
  3.    Cannot return the same result as a query that is not a subquery.
  4.    All of the above
Explanation:-
Answer: Option B. -> Involves the use of an inner and outer query.

Question 9. A database is used to
  1.    store data
  2.    modify data
  3.    extract data
  4.    All of the above
Explanation:-
Answer: Option D. -> All of the above

Question 10. AND, OR and NOT are examples of
  1.    Clauses
  2.    Boolean operators
  3.    Conjuctive operators
  4.    Exclusive operators
Explanation:-
Answer: Option B. -> Boolean operators