DROP DB (usually written as DROP DATABASE) is a data definition language (DDL) command that removes a database catalog from the server. Once executed, every schema object inside the database—tables, views, procedures, functions, and data—is irretrievably erased. The command requires exclusive access to the target database and sufficient privileges (typically superuser or DROP privilege). Many systems offer an optional IF EXISTS clause to prevent errors when the database name is incorrect. Because the action is irreversible, it is common to wrap the statement in a transaction only if the underlying database engine supports transactional DDL; otherwise, a backup should be taken first.
IF EXISTS
(optional keyword) - skips the error if database_name is not founddatabase_name
(identifier) - name of the database to removeCREATE DATABASE, ALTER DATABASE, DROP SCHEMA, DROP TABLE, BACKUP DATABASE
SQL:1999
Yes. Every object inside the database catalog is removed with the command.
Use IF EXISTS: `DROP DATABASE IF EXISTS db_name;` This safely skips the drop when the name is absent.
Only if your database engine supports transactional DDL and the command is run inside a transaction that has not been committed. For most systems, the action is permanent.
The target database still has active connections. Terminate or disconnect those sessions, then rerun the statement.