Which of the following SQL statements deletes all rows in table called SalesData?

  1. DELETE FROM SalesData

  2. DELETE * FROM SalesData

  3. DELETE SalesData

  4. DELETE ALL SalesData


Correct Option: A
Explanation:

To solve this question, the user needs to know the basic syntax of the SQL DELETE statement. The correct answer is:

The Answer is: A

Explanation:

A. DELETE FROM SalesData: This option is correct because it follows the correct syntax for deleting all rows from a table. The DELETE statement is used to delete existing records in a table, and the FROM keyword specifies the table from which to delete the rows. So, this statement will delete all rows from the SalesData table.

B. DELETE * FROM SalesData: This option is incorrect because it does not follow the correct syntax for the DELETE statement. The asterisk (*) is not required in the DELETE statement and may cause an error.

C. DELETE SalesData: This option is also incorrect because it does not follow the correct syntax for the DELETE statement. The table name should be preceded by the keyword FROM, which is missing in this option.

D. DELETE ALL SalesData: This option is incorrect because it also does not follow the correct syntax for the DELETE statement. The keyword ALL is not necessary and will cause an error.

Find more quizzes: