MCQs – SQL Basics


Q) Wrong statement about UPDATE keyword is

  1. If WHERE clause in missing in statement the all records will be updated.
  2. Only one record can be updated at a time using WHERE clause
  3. Multiple records can be updated at a time using WHERE clause
  4. None is wrong statement
View Answer
Answer: B
If you omit the WHERE clause, ALL records will be updated.

 

Q) Wrong statement about ORDER BY keyword is

  1. Used to sort the result-set in ascending or descending order
  2. The ORDER BY keyword sorts the records in ascending order by default.
  3. To sort the records in ascending order, use the ASC keyword.
  4. To sort the records in descending order, use the DECENDING keyword.
View Answer
Answer: D
To sort the records in descending order DESC keyword is used.

Q) Correct syntax query syntax to drop a column from a table is

  1. DELETE COLUMN column_name;
  2. DROP COLUMN column_name;
  3. ALTER TABLE table_name DROP COLUMN column_name;
  4. None is correct.
View Answer
Answer: C
To drop a column from an existing table, first table should be altered using ALTER TABLE statement.


Q) If you want to allow age of a person > 18 in the column Age of table Person, then which constraint will be applied to AGE column.

  1. Default
  2. Check
  3. NOT NULL
  4. None
View Answer
Answer: B
CHECK constraint is used to limit the value range placed in a column