Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

SQL DML MCQS

1. Which SQL statement is used to add new records to a table?

a) SELECT
b) INSERT
c) UPDATE
d) DELETE

Answer: b) INSERT

Explanation: The INSERT statement is used to add new records (rows) to a table in a database.


2. What does the SQL DELETE statement do?

a) Deletes all records from a table
b) Deletes specific records from a table
c) Deletes columns from a table
d) Deletes the entire database

Answer: b) Deletes specific records from a table

Explanation: The DELETE statement removes specific records (rows) from a table based on specified conditions.


3. In SQL, how do you specify conditions for the DELETE statement?

a) USING
b) WHERE
c) HAVING
d) CONDITION

Answer: b) WHERE

Explanation: The WHERE clause is used in conjunction with the DELETE statement to specify conditions for which rows to delete from a table.


4. What is the purpose of the SQL UPDATE statement?

a) To add new records to a table
b) To delete records from a table
c) To modify existing records in a table
d) To create a new table

Answer: c) To modify existing records in a table

Explanation: The UPDATE statement is used to modify existing data in a table by changing the values of specific columns in specific rows.


5. How can you apply conditions to the UPDATE statement in SQL?

a) CONDITION
b) WITH
c) SET
d) WHERE

Answer: d) WHERE

Explanation: The WHERE clause is used with the UPDATE statement to specify the conditions that must be met for the update to occur.


6. Which SQL statement combines INSERT, UPDATE, and DELETE operations into a single statement?

a) COMBINE
b) JOIN
c) MERGE
d) UNITE

Answer: c) MERGE

Explanation: The MERGE statement in SQL allows you to perform a combination of INSERT, UPDATE, and DELETE operations based on a specified condition.


7. What is the purpose of the SQL DML command “INSERT”?

a) To retrieve data from a table
b) To modify existing data in a table
c) To add new data into a table
d) To remove data from a table

Answer: c) To add new data into a table

Explanation: The INSERT command in SQL is used to add new rows of data into a table.


8. Which SQL clause is used to specify the conditions for deleting records with the DELETE statement?

a) CONDITION
b) WHERE
c) DELETE_CONDITION
d) RESTRICT

Answer: b) WHERE

Explanation: The WHERE clause is used with the DELETE statement to specify the conditions under which rows should be deleted from a table.


9. In SQL, what does the UPDATE statement do?

a) Adds new records to a table
b) Deletes records from a table
c) Modifies existing records in a table
d) Creates a new table

Answer: c) Modifies existing records in a table

Explanation: The UPDATE statement in SQL is used to modify existing data within a table by changing the values of specific columns in specific rows.


10. Which SQL statement allows you to perform conditional actions like INSERT, UPDATE, or DELETE based on a specified condition?

a) IF-THEN
b) CASE
c) MERGE
d) CONDITION

Answer: c) MERGE

Explanation: The MERGE statement in SQL allows conditional actions like INSERT, UPDATE, or DELETE based on a specified condition, making it a versatile command for data manipulation.

Leave a Comment