⌘+k ctrl+k
1.4 (stable)
Search Shortcut cmd + k | ctrl + k
ALTER DATABASE Statement

The ALTER DATABASE command modifies a DuckDB database. This command can be used to change a database's name without needing to detach and reattach it.

Syntax

RENAME DATABASE

The following scenarios are not supported when renaming a DuckDB database with ALTER DATABASE:

  • Renaming a database to certain reserved keywords such as system or temp.
  • Renaming a database to the same name of a database attached in memory.

Rename a database from old_name to new_name:

ALTER DATABASE old_name RENAME TO new_name;

Check if a database exists and rename it:

ALTER DATABASE IF EXISTS non_existent RENAME TO something_else;
© 2025 DuckDB Foundation, Amsterdam NL
Code of Conduct Trademark Use