Sample Exam Questions

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

Sample Question

3.53

You want to delete all data from the 'test' table and leave it empty. Choose two appropriate statements.


  1. Execute 'DELETE * FROM test;'.

  2. Execute 'DELETE ALL FROM test;'.

  3. Execute 'DELETE FROM test;'.

  4. Execute 'DROP ROWS FROM test;'.

  5. You can also execute 'TRUNCATE test;', which is faster.

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

Answer and Explanation

To delete data from a table, use the DELETE statement. The basic syntax is:
DELETE FROM table_name WHERE condition_expression

Rows for which the result of evaluating the condition expression is true are deleted. If the WHERE clause is omitted, all rows in the table are deleted. If the transaction feature is enabled, you can revert with ROLLBACK, but if not, you may lose all data unexpectedly, so please be very careful when executing.

While DELETE scans the table and deletes data even without a WHERE clause, TRUNCATE releases the data area of the table without scanning the table, allowing the table to be emptied more quickly.

Options A, B, and D are all incorrect in terms of SQL syntax.

Therefore, the correct answers are C and E.