v.23.9New Feature

Add IF EMPTY clause for DROP TABLE queries

Add IF EMPTY clause for DROP TABLE queries. #48915 (Pavel Novitskiy).
Added the IF EMPTY clause for DROP TABLE queries in ClickHouse.

Why it matters

This feature allows users to drop tables only if they are empty, preventing accidental deletion of tables containing data. It enhances safety and control when managing table lifecycles.

How to use it

Use the DROP TABLE statement with the new IF EMPTY clause to drop a table only if it has no data. For example:

DROP TABLE IF EMPTY table_name;