250+ TOP MCQs on Multiple – Table Deletes and Updates and Answers

MySQL Database Multiple Choice Questions on “Table Deletes and Updates”.

1. To perform a delete on a single-table, how is the name of a column qualified?
a) qualification not necessary
b) column name
c) table name
d) database name

Answer: a
Clarification: In MySQL, performing the operations ‘UPDATE’ and ‘DELETE’ on a single-table does not require qualifying the column name of the table in the database with the table name of the database.

2. What is xyz in the following SQL statement?

	DELETE FROM xyz WHERE abc = 5;

a) column name
b) table name
c) row name
d) database name

Answer: b
Clarification: The operation being performed in the statement is the ‘DELETE’. The table name is ‘xyz’ and column name is ‘abc’. When this statement is executed, rows having abc value equal to 5 get deleted.

3. A multiple-table delete can apply any join.
a) True
b) False

Answer: a
Clarification: In MySQL, a multiple table ‘DELETE’ operation can be performed on the tables combined using any kind of ‘JOIN’ operation. The syntax also allows for deleting rows from multiple tables at once.

4. What is abc in the following SQL statement?

	DELETE FROM xyz WHERE abc = 5;

a) column name
b) table name
c) row name
d) database name

Answer: a
Clarification: Here, the operation that is being performed in the statement is the ‘DELETE’ operation. The table name is ‘xyz’ and column name is ‘abc’. The rows having abc value equal to 5 get deleted.

5. What is x in the following MySQL statement?

	DELETE FROM x USING x LEFT JOIN y ON x.col = y.col;

a) column name
b) table name
c) server name
d) database name

Answer: b
Clarification: The ‘DELETE’ operation is being performed in the statement. The table names are ‘x’ and ‘y’. The column name is ‘col’. The rows from left join of x and y get deleted according to the condition given.

6. Qualifying the name of column with the table name is not necessary in single-table updates.
a) True
b) False

Answer: a
Clarification: When it comes to single table ‘UPDATE’ and ‘DELETE’ operations, the qualification of a column name with the table name is not necessary. So the table name qualifier can be omitted.

7. What is the value of val2 in the following MySQL statement?

	UPDATE t SET val1 = val1 + 2, val2 = val1;

a) previous val1
b) updated val1
c) unchanged
d) val1 + 1

Answer: b
Clarification: The second assignment here (val2 = val1) sets the value of val2 to the updated val1, that is, previous val1 incremented by two. ‘t’ is the name of the table here. ‘val1’ and ‘val2’ are columns.

8. UPDATE statement is a DML statement. What does DML stand for?
a) Data Manipulation Language
b) Data Manipulation Level
c) Data Markup Language
d) Data Markup Level

Answer: a
Clarification: The ‘UPDATE’ statement in MySQL is a ‘Data Manipulation Language’ statement. It performs edits on real tables present or loaded directly from the stored database. It is used in similar lines with ‘DELETE’.

9. Which keyword in the UPDATE statement is used to assign values to columns?
a) ASSIGN
b) SET
c) MARK
d) GET

Answer: b
Clarification: The ‘UPDATE’ statement in MySQL has its own syntax. The ‘SET’ keyword is followed by an assignment list which indicates the set of columns whose value needs to be updated with a specified value.

10. Which keyword is used to delete all the rows from the table?
a) TRUNCATE
b) REMOVE
c) DELETE ALL
d) CLEAR

Answer: a
Clarification: The ‘TRUNCATE’ keyword in MySQL is used to delete all the rows from the table and also free the space containing the table. Its syntax is: TRUNCATE TABLE my_table. This deletes all rows from my_table.

Leave a Reply

Your email address will not be published. Required fields are marked *