MCQ – This section contains multiple choice questions on SQL Commands with answers and explanation. Many of the objective questions are asked in software jobs written interviews.


Q) Which SQL commands can be used to delete all records from the table in a sql database?
  1. Delete
  2. Delete with where condition
  3. TRUNCATE
  4. DROP

Answer: 1 and 3

Read difference between delete, truncate and drop SQL commands.


 
Q) SQL Select statement to retrieve unique record from a table is
  1. SELECT DISTINCT
  2. SELECT UNIQUE
  3. SELECT UNION
  4. SELECT UNION ALL

Answer: 1


 
Q) SQL Command to remove stored procedure SQL
  1. Remove
  2. Drop
  3. Delete
  4. Erase

Answer: 2
NOTE: Stored procedure in SQL is also called stored function.


 
Q) Which SQL sub language is used for creating and destroying table structure?
  1. DDL
  2. DML
  3. TCL
  4. DCL

Answer: 1

Read detail of DDL and DML commands in SQL.



Q) SQL Trigger automatically executed on operations
  1. Insert
  2. Delete
  3. Update
  4. None
  5. all

Answer: 5


Q) Correct SQL query to delete a column from a table in SQL Server database
  1. DROP COLUMN columnName FROM table name
  2. DELETE columnName FROM tableName
  3. ALTER TABLE tablename, DROP COLUMN columnName
  4. None

Answer: 3.
To modify a column of a table, first we need to alter table and then drop a column whatever we want.


Related Posts