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?
- Delete
- Delete with where condition
- TRUNCATE
- 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
- SELECT DISTINCT
- SELECT UNIQUE
- SELECT UNION
- SELECT UNION ALL
Answer: 1
Q) SQL Command to remove stored procedure SQL
- Remove
- Drop
- Delete
- 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?
- DDL
- DML
- TCL
- DCL
Answer: 1
Read detail of DDL and DML commands in SQL.
Q) SQL Trigger automatically executed on operations
- Insert
- Delete
- Update
- None
- all
Answer: 5
Q) Correct SQL query to delete a column from a table in SQL Server database
- DROP COLUMN columnName FROM table name
- DELETE columnName FROM tableName
- ALTER TABLE tablename, DROP COLUMN columnName
- None
Answer: 3.
To modify a column of a table, first we need to alter table and then drop a column whatever we want.