MCQs – SQL Basics

(Last Updated On: March 28, 2018)

Q) In a table, a column contains duplicate value, if you want to list all different value only, then which SQL clause is used?

  1. SQL DISTINCT
  2. SQL UNIQUE
  3. SQL BETWEEN
  4. SQL Exists
View Answer
Answer: A
DISTINCT keyword is used to fetch different (unique) value. UNIQUE keyword is known as constraint that is applied to a table, e.g. if UNIQUE is applied to a column, that column will allow only unique records to store and will not accept duplicate record.


 

Q) To give a temporary name to a table, or a column in a table for more readability, what is used?

  1. SQL Wildcards
  2. SQL aliases
  3. SQL LIKES
  4. SQL Comments
View Answer
Answer: B


Q) What does below SQL statement describe?

SELECT CustomerName, Address + ‘, ‘ + City + ‘, ‘ + Country AS Address

FROM Customers;

  1. Alias named Address column will be created and under this Address, City and Country will be printed as combined statement.
  2. Alias named Address will be created for Country columns
  3. Alias named Address column will be created and under this all CustomerName, address, city and country will be printed as combined statement
  4. All above options are wrong
View Answer
Answer: A


Q) Logical operators used in SQL are

  1. AND, OR , NOT
  2. &&, ||, !
  3. $,|,!
  4. None of the above
View Answer
Answer: A