Sample Exam Questions

From the objective of OSS-DB Exam Silver
S3.1 SQL commands (DELETE statement)

Sample Question

3.33

What happens if the following command is executed?
DELETE FROM table_name;


  1. An error occurs because the SQL syntax is wrong.

  2. Although it is recognized as a data deletion SQL command, nothing is deleted because there are no rows that match the WHERE clause.

  3. A prompt asking whether to delete the data is displayed.

  4. All rows in the table 'table_name' are deleted and the table becomes empty.

  5. The table 'table_name' is dropped.

※This sample exam is different from those that appear in the actual OSS-DB Exam.
2024/05/02

Answer and Explanation

The standard form of the DELETE statement is:
DELETE FROM table_name WHERE condition_expression
However, it's easier to understand if you think of the rows that would be displayed when executing:
SELECT * FROM table_name WHERE condition_expression
as the rows that would be deleted when the DELETE statement is executed.


The DELETE statement in the example does not have a WHERE clause, but this is not a problem in terms of SQL syntax.
When you execute 'SELECT * FROM table_name', all the rows that exist in the specified table are displayed. Therefore, when you execute 'DELETE FROM table_name', all rows in the table are deleted. Although it might be helpful to have a warning or confirmation dialog for such a dangerous command, SQL does not provide such a feature.

Therefore, the correct answer is D.

Note: If you really want to empty a table, using TRUNCATE is faster than using DELETE.