1Z0-888 · Question #37
Consider this statement on a RANGE-partitioned table: mysql> ALTER TABLE orders DROP PARTITION p1, p3; What is the outcome of executing this statement?
The correct answer is B. All data in p1 and p3 partitions is removed, but the table definition remains unchanged. Dropping multiple partitions in a single ALTER TABLE ... DROP PARTITION statement is valid MySQL syntax - comma-separated partition names are explicitly supported - so both C and D are wrong. When MySQL executes this statement, it removes p1 and p3 from the table's partition…
Question
mysql> ALTER TABLE orders DROP PARTITION p1, p3; What is the outcome of executing this statement?Options
- AAll data in p1 and p3 partitions is removed and the table definition is unchanged.
- BAll data in p1 and p3 partitions is removed, but the table definition remains unchanged.
- COnly the first partition (p1) will be dropped because only one partition can be dropped at any time.
- DIt results in a syntax error because you cannot specify more than one partition in the same statement.
How the community answered
(28 responses)- B89% (25)
- C4% (1)
- D7% (2)
Explanation
Dropping multiple partitions in a single ALTER TABLE ... DROP PARTITION statement is valid MySQL syntax - comma-separated partition names are explicitly supported - so both C and D are wrong. When MySQL executes this statement, it removes p1 and p3 from the table's partition scheme and permanently deletes all rows stored in those partitions; there is no soft delete or staging step. Option A is a near-identical distractor to B but is designed to suggest the partition metadata might be preserved while only data is removed, which is not the case - the partition entries themselves are gone from the table definition. Option B is correct because it accurately reflects that the data destruction is complete across both named partitions and that the rest of the table (its columns, indexes, and remaining partitions) is otherwise structurally intact.
Memory tip: Think of DROP PARTITION as DELETE + TRUNCATE + ALTER rolled into one - it kills the data and the partition slot in one irreversible step, and you can name as many victims as you want in a single statement.
Topics
Community Discussion
No community discussion yet for this question.