How to Rename Database in SQL?
To change the name of a database in SQL, use the syntax:
ALTER DATABASE [current_database_name]
MODIFY NAME = [new_database_name];
To rename a database in MySQL use the query:
RENAME DATABASE [current_database_name] TO [new_database_name];
Note: SQL RENAME DATABASE statement is used in MySQL, and for other SQL distributions, we need to use ALTER DATABASE statement with MODIDY NAME clause.
SQL Query to Rename Database
To rename a database in SQL use the ALTER DATABASE Statement with MODIFY NAME clause.
The ALTER command in SQL is used to make changes to a table or database. In this article, we will learn how to use the ALTER DATABASE statement with the MODIFY NAME clause to rename a database.