DocMCQs Educational Banner

Which of the following command is correct to delete the values in the relation teaches?

Question: Which of the following command is correct to delete the values in the relation teaches?
  • A. a) Delete from teaches;
  • B. b) Delete from teaches where Id =’Null’;
  • C. c) Remove table teaches;
  • D. d) Drop table teaches;
Correct Answer: A. a) Delete from teaches;
Explanation: Breakdown of other options:

DELETE FROM teaches WHERE Id = 'Null';: This command would only delete rows where the Id column has a NULL value. It wouldn't delete all rows.

REMOVE TABLE teaches;: There's no standard SQL command named REMOVE.

DROP TABLE teaches;: This command would delete the entire table structure, including its data and definition, which is typically not desired when you just want to clear the data.

So, the simple and effective way to delete all data from the teaches table is by using DELETE FROM teaches;.

Leave a Comment

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

Join Our WhatsApp Channel ×
Scroll to Top