MySQL Questions and Answers – Multiple – Table Deletes and Updates

This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses 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
View Answer

Answer: a
Explanation: 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
View Answer

Answer: b
Explanation: 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.
advertisement
advertisement

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

Answer: a
Explanation: 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.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

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
View Answer

Answer: a
Explanation: 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.
advertisement

5. What is x in the following MySQL statement?

advertisement
	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
View Answer

Answer: b
Explanation: 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
View Answer

Answer: a
Explanation: 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
View Answer

Answer: b
Explanation: 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
View Answer

Answer: a
Explanation: 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
View Answer

Answer: b
Explanation: 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
View Answer

Answer: a
Explanation: 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.

Sanfoundry Global Education & Learning Series – MySQL Database.

To practice all areas of MySQL Database, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.