SQL Rename Database Example

Let’s look at an example of how to rename a database in SQL.

First, we will create a database which will be renamed in the example:

Query:

CREATE DATABASE Test

Output:

Rename database in SQL Example

In this example, we will use the ALTER command with MODIFY NAME clause to rename the database.

Query:

ALTER DATABASE Test MODIFY NAME = Example

Output:

The database name is changed from Test to Example.


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.

Similar Reads

How to Rename Database in SQL?

To change the name of a database in SQL, use the syntax:...

SQL Rename Database Example

Let’s look at an example of how to rename a database in SQL....

Contact Us