{"id":97085,"date":"2020-11-16T11:00:00","date_gmt":"2020-11-16T09:00:00","guid":{"rendered":"https:\/\/examples.javacodegeeks.com\/?p=97085"},"modified":"2020-11-16T18:54:11","modified_gmt":"2020-11-16T16:54:11","slug":"sql-rename-database","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/","title":{"rendered":"SQL Rename Database"},"content":{"rendered":"<p>In this article, we will explain how to rename a database using SQL.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-1-introduction\">1. Introduction<\/h2>\n<p>In this article, we will look at one of the Data Definition Language or data description language (DDL) concepts called Rename the Database. We will see how we do this in the MySQL database.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-1-1-what-is-data-definition-language\">1.1 What is Data definition language?<\/h3>\n<p>In SQL, Data definition language is a syntax for creating and modifying database objects like tables, schemas, views, and users. Common examples of DDL statements are<\/p>\n<ul class=\"wp-block-list\">\n<li>CREATE &#8211; to create objects in the database<\/li>\n<li>ALTER &#8211; alters the structure of the database<\/li>\n<li>DROP &#8211; delete objects from the database<\/li>\n<li>TRUNCATE &#8211; remove all records from a table, including all spaces allocated for the records are removed<\/li>\n<li>COMMENT &#8211; add comments to the data dictionary<\/li>\n<li>RENAME &#8211; rename an object<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"h-2-rename-database\">2. Rename Database<\/h2>\n<p>As per SQL the syntax for renaming a database schema is as follows:<\/p>\n<pre class=\"brush:sql\"> RENAME {DATABASE | SCHEMA} db_name TO new_db_name; <\/pre>\n<p>However, as of now, most RDBMS systems do not support this syntax. Most RDBMS support the ALTER syntax instead which has renaming as one of the options available and some RDBMS like MySQL does not support it at all.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-2-1-rename-or-alter-syntax\">2.1 Rename or Alter syntax<\/h3>\n<p>Most RDBMS like SQL Server, PostgreSQL support the Alter command for renaming a Database. Depending upon the RDBMS, the syntax is modified.<\/p>\n<h4 class=\"wp-block-heading\" id=\"h-2-1-1-sql-server\">2.1.1 SQL SERVER<\/h4>\n<p>The SQL server supports the Alter Database command. This command has multiple options available out of which the Database name is one. The syntax is as follows<\/p>\n<pre class=\"brush:sql\"> ALTER DATABASE [Database|Schema] MODIFY NAME = [New database|schema name]<\/pre>\n<p><\/p>\n<p>The details of the Alter command in the SQL Server are available <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/relational-databases\/databases\/rename-a-database?view=sql-server-ver15\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n<h4 class=\"wp-block-heading\" id=\"h-2-1-2-postgre-sql\">2.1.2 Postgre SQL<\/h4>\n<p>Postgre SQL also supports the ALTER Database command which has rename as one of its options. The syntax is as follows<\/p>\n<pre class=\"brush:sql\"> ALTER DATABASE [name] RENAME to [new_name]; <\/pre>\n<p>The Complete details of the ALTER command in POSTGRE SQL are available <a href=\"https:\/\/www.postgresql.org\/docs\/current\/sql-alterdatabase.html\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n<h4 class=\"wp-block-heading\" id=\"h-2-1-3-mysql\">2.1.3 MySQL<\/h4>\n<p>The RENAME database command was introduced in the MYSQL version 5.1. However, <em>it is now obsolete and not supported<\/em>. The syntax of the Rename Database command was as follows:<\/p>\n<pre class=\"brush:sql\"> RENAME {DATABASE|SCHEMA} db_name TO new_db_name;<\/pre>\n<p>The reason it is not supported as per MySQL is<\/p>\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>This statement was added in MySQL 5.1.7 but was found to be dangerous and was removed in MySQL 5.1.23. It was intended to enable upgrading pre-5.1 databases to use the encoding implemented in 5.1 for mapping database names to database directory names. However, the use of this statement could result in a loss of database contents, which is why it was removed. Do not use&nbsp;RENAME DATABASE&nbsp;in earlier versions in which it is present. To perform the task of upgrading database names with the new encoding, use&nbsp;ALTER DATABASE&nbsp;db_name&nbsp;UPGRADE DATA DIRECTORY NAME&nbsp;instead.<\/p>\n<p><cite><a href=\"http:\/\/web.archive.org\/web\/20160504181056\/https:\/\/dev.mysql.com\/doc\/refman\/5.1\/en\/rename-database.html\" target=\"_blank\" rel=\"noreferrer noopener\">MySQL 5.1 Reference Manual<\/a><\/cite><\/p><\/blockquote>\n<h2 class=\"wp-block-heading\" id=\"h-3-so-how-do-we-rename-a-database-in-mysql\">3. So, how do we Rename a Database in MySQL?<\/h2>\n<p>There is no straightforward command to do this. However, there a couple of ways in which this can be achieved.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h3 class=\"wp-block-heading\" id=\"h-3-1-rename-mysql-database-from-command-line\">3.1 Rename MySQL Database from Command Line<\/h3>\n<p>To rename a database in MySQL, the easiest way is to use the mysqldump functionality to generate a dump of the database, create a new database, and then import the generated dump into it. To see these steps in action, we have a database called \u201ctest_db\u201d which holds employee data. This database we will rename to \u201cempDB\u201d.<\/p>\n<p>The Steps to perform this are as follows<\/p>\n<h4 class=\"wp-block-heading\" id=\"h-3-1-1-step-1-create-a-dump-of-the-to-be-renamed-database\">3.1.1 <strong>Step 1<\/strong> : Create a dump of the to-be-renamed database<\/h4>\n<p>To generate the dump of the database, we use the sqldump utility. The documentation of the utility is available <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/mysqldump.html\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n<ul class=\"wp-block-list\">\n<li>Open the command prompt. First, check if MYSQL is in the PATH or not. If not set the PATH to MYSQL Server executable path. To check if PATH is set or not, use the command:<\/li>\n<\/ul>\n<pre class=\"brush:bash\">mysql --version <\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"699\" height=\"724\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/MYSQL_PATH.jpg\" alt=\"SQL Rename Database - Set MySql in the Path variable.\" class=\"wp-image-97090\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/MYSQL_PATH.jpg 699w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/MYSQL_PATH-290x300.jpg 290w\" sizes=\"(max-width: 699px) 100vw, 699px\" \/><figcaption>MYSQL Path<\/figcaption><\/figure>\n<\/div>\n<ul class=\"wp-block-list\">\n<li>Next, check that the database which needs renaming is present in the list of databases. To do so, we can open a \u201cSQL Command line client\u201d and use the command<\/li>\n<\/ul>\n<pre class=\"brush:bash\"> show databases; <\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"810\" height=\"525\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/test_db.jpg\" alt=\"SQL Rename Database - Database that needs to be renamed\" class=\"wp-image-97091\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/test_db.jpg 810w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/test_db-300x194.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/test_db-768x498.jpg 768w\" sizes=\"(max-width: 810px) 100vw, 810px\" \/><figcaption>Database that needs to be renamed<\/figcaption><\/figure>\n<\/div>\n<ul class=\"wp-block-list\">\n<li>In the command prompt, generate the dump file for the database. The general syntax for this is<\/li>\n<\/ul>\n<pre class=\"brush:bash\">mysqldump \u2013u [UserName] \u2013p[Password] \u2013R [DB_Name] &gt; [DB_Name].sql<\/pre>\n<p>Here, we will replace<\/p>\n<li>UserName with the username root<\/li>\n<li>Password will be prompted after the command is triggered.<\/li>\n<li>DB_Name the to-be-renamed database.<\/li>\n<p>So, our syntax will be &#8211;<\/p>\n<pre class=\"brush:bash\">mysqldump -u root -p -R test_db &gt; test_db.sql<\/pre>\n<p>This generates a dump file in the current folder.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"820\" height=\"611\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/sql_dump_created.jpg\" alt=\"SQL Rename Database - Dump of the MySQL Database\" class=\"wp-image-97092\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/sql_dump_created.jpg 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/sql_dump_created-300x224.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/sql_dump_created-768x572.jpg 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>Dump of the MySQL Database<\/figcaption><\/figure>\n<\/div>\n<h4 class=\"wp-block-heading\" id=\"h-3-1-2-step-2-create-a-new-database\">3.1.2 <strong>Step 2:<\/strong>  Create a new database<\/h4>\n<p>Using the mysqladmin utility we can create a new and empty database through the command line itself. The documentation is available <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/mysqladmin.html\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>. The general syntax to do this is:<\/p>\n<pre class=\"brush:bash\"> mysqladmin -u[UserName] -p[Password] create [newDbName] <\/pre>\n<p>So our syntax is<\/p>\n<pre class=\"brush:bash\"> mysqladmin -u root -p create empDB <\/pre>\n<p>To verify that the database has been created successfully, in the command prompt, type<\/p>\n<pre class=\"brush:bash\"> mysql -u root -p <\/pre>\n<p>Once triggered, it will prompt for a password. This will open the \u201cMySQL\u201d prompt. Then type the command<\/p>\n<pre class=\"brush:bash\">show databases;<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"813\" height=\"663\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/verifydatabase_creation.jpg\" alt=\"SQL Rename Database - new database creation\" class=\"wp-image-97093\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/verifydatabase_creation.jpg 813w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/verifydatabase_creation-300x245.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/verifydatabase_creation-768x626.jpg 768w\" sizes=\"(max-width: 813px) 100vw, 813px\" \/><figcaption>New Database created<\/figcaption><\/figure>\n<\/div>\n<p>In the output, we should see the new database created.<\/p>\n<h4 class=\"wp-block-heading\" id=\"h-3-1-3-step-3-import-the-dump-file-in-the-new-database\">3.1.3 <strong>Step 3:<\/strong> Import the dump file in the new database<\/h4>\n<p>We use the following general syntax to import the dump file in the new database.<\/p>\n<pre class=\"brush:bash\">mysql -u [UserName] -p[Password] [newDbName] &lt; [oldDbName].sql<\/pre>\n<p>here we replace<\/p>\n<li>Username = root<\/li>\n<li>Password will be prompted once the command is triggered<\/li>\n<li>newDbName = Database we just created<\/li>\n<li>oldDbName.sql = dump file we created for the old database. <\/li>\n<p>So, the final syntax is <\/p>\n<pre class=\"brush:bash\">mysql -u root -p empDB &lt; test_db.sql<\/pre>\n<h4 class=\"wp-block-heading\" id=\"h-3-1-4-step-4-delete-the-old-database\">3.1.4 <strong>Step 4:<\/strong> Delete the old Database<\/h4>\n<p>This step is optional but is preferred .The syntax to drop the database is <\/p>\n<pre class=\"brush:bash\"> mysqladmin -u [UserName] -p[Password] drop [oldDbName] <\/pre>\n<ul class=\"wp-block-list\">\n<li>UserName = root<\/li>\n<li>Password  will be prompted once the command is triggered<\/li>\n<li>oldDbName = the renamed-database<\/li>\n<\/ul>\n<p>So, the final syntax is <\/p>\n<pre class=\"brush:bash\">mysqladmin -u root -p drop test_db<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"715\" height=\"820\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/database_dropped.jpg\" alt=\"SQL Rename Database - Database dropped\" class=\"wp-image-97094\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/database_dropped.jpg 715w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/database_dropped-262x300.jpg 262w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><figcaption>Database dropped<\/figcaption><\/figure>\n<\/div>\n<h3 class=\"wp-block-heading\" id=\"h-3-2-rename-the-database-using-innodb\">3.2 Rename the Database using InnoDB<\/h3>\n<p>All versions of MYSQL 5.5 and above have the InnoDB storage engine. InnoDB is a general-purpose storage engine and can be used in a way to rename a database. The InnoDB documentation is available <a rel=\"noreferrer noopener\" href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/innodb-introduction.html\" target=\"_blank\">here<\/a>.<\/p>\n<p>Using InnoDB engine, we are not able to rename the Database directly. But it is easy to rename tables and transfer them to a new database without copying the entire contents of the tables. This is tantamount to renaming the database itself. The steps we follow are as follows<\/p>\n<h4 class=\"wp-block-heading\" id=\"h-3-2-1-step-1-create-a-new-database\">3.2.1 <strong>Step 1<\/strong> : Create a new database<\/h4>\n<p>Before InnoDB can rename tables to another database, the database needs to be created. We can use the sqladmin utility used in the previous method to create a new Database. As an example, we will create the \u201cemployeesdb\u201d database.<\/p>\n<h4 class=\"wp-block-heading\" id=\"h-3-2-2-step-2-rename-tables-manually\">3.2.2 Step 2: Rename tables manually<\/h4>\n<p>We can just manually use the rename table command and move all the tables to the different schema. While doing this, Views cannot be renamed to the other schema. The Views need to be dropped and rebuilt in the other schema. To do this,<\/p>\n<ul class=\"wp-block-list\">\n<li>First enter the mysql command line by the command<\/li>\n<\/ul>\n<pre class=\"brush:bash\">mysql -u root -p<\/pre>\n<p>Then we can check the tables are present in the empdb and also the employeesdb.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"791\" height=\"314\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/before_rename.jpg\" alt=\"SQL Rename Database - Tables present in both the databases before Rename using Inno DB storage engine\" class=\"wp-image-97096\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/before_rename.jpg 791w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/before_rename-300x119.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/before_rename-768x305.jpg 768w\" sizes=\"(max-width: 791px) 100vw, 791px\" \/><figcaption>Tables present in both databases before Rename <\/figcaption><\/figure>\n<\/div>\n<ul>\n<li>Then rename individual tables, we use the command:<\/li>\n<\/ul>\n<pre class=\"brush:bash\"> RENAME TABLE [OLD_DB_NAME].[Table_Name] to [NEW_DB_NAME].[Table_Name]<\/pre>\n<p><\/p>\n<p>Here we replace:<\/p>\n<li>OLD_DB_NAME = to-be-renamed database name<\/li>\n<li> Table_Name = name of the table that needs to moved<\/li>\n<li> New_DB_NAME = new databse we created<\/li>\n<p>The command we use is<\/p>\n<pre class=\"brush:bash\">RENAME TABLE empdb.employees to employeesdb.employees<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"808\" height=\"784\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/renaming_using_innodb.jpg\" alt=\"SQL Rename Database - Rename using InnoDB storage engine\" class=\"wp-image-97095\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/renaming_using_innodb.jpg 808w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/renaming_using_innodb-300x291.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/renaming_using_innodb-768x745.jpg 768w\" sizes=\"(max-width: 808px) 100vw, 808px\" \/><figcaption>Rename using InnoDB storage engine<\/figcaption><\/figure>\n<\/div>\n<p>This effectively renames the database.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-4-summary\">4. Summary<\/h2>\n<p>In general, we saw 2 main ways of renaming the database in MySQL since there is no direct way in which we can do so. We can also use other ready-made utilities like cPanel and Percona which provide scripts to rename databases.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-5-download-the-source-code\">5. Download the Source Code<\/h2>\n<p>In this article, we explained how to rename a database using SQL, using MySQL RDBMS. Attached are all the commands we need to run in the command prompt.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/11\/SQL_Rename_DB.zip\"><strong> SQL Rename Database<br \/>\n<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will explain how to rename a database using SQL. 1. Introduction In this article, we will look at one of the Data Definition Language or data description language (DDL) concepts called Rename the Database. We will see how we do this in the MySQL database. 1.1 What is Data definition language? &hellip;<\/p>\n","protected":false},"author":232,"featured_media":1204,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53],"tags":[647],"class_list":["post-97085","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sql","tag-mysql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SQL Rename Database - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this article, we will explain how to rename a database using SQL. 1. Introduction In this article, we will look at one of the Data Definition Language\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Rename Database - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this article, we will explain how to rename a database using SQL. 1. Introduction In this article, we will look at one of the Data Definition Language\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2020-11-16T09:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-11-16T16:54:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Reshma Sathe\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Reshma Sathe\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/\"},\"author\":{\"name\":\"Reshma Sathe\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/079aa9a12c7b8ebea3391ebeb6036a74\"},\"headline\":\"SQL Rename Database\",\"datePublished\":\"2020-11-16T09:00:00+00:00\",\"dateModified\":\"2020-11-16T16:54:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/\"},\"wordCount\":1227,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"keywords\":[\"mysql\"],\"articleSection\":[\"sql\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/\",\"name\":\"SQL Rename Database - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"datePublished\":\"2020-11-16T09:00:00+00:00\",\"dateModified\":\"2020-11-16T16:54:11+00:00\",\"description\":\"In this article, we will explain how to rename a database using SQL. 1. Introduction In this article, we will look at one of the Data Definition Language\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"Bipartite Graph\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Core Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"sql\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/sql\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"SQL Rename Database\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/079aa9a12c7b8ebea3391ebeb6036a74\",\"name\":\"Reshma Sathe\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/08\/reshma_sathe-96x96.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/08\/reshma_sathe-96x96.png\",\"caption\":\"Reshma Sathe\"},\"description\":\"I am a recent Master of Computer Science degree graduate from the University Of Illinois at Urbana-Champaign.I have previously worked as a Software Engineer with projects ranging from production support to programming and software engineering.I am currently working on self-driven projects in Java, Python and Angular and also exploring other frontend and backend technologies.\",\"sameAs\":[\"www.linkedin.com\/in\/reshma-sathe\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/reshma-sathe\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQL Rename Database - Java Code Geeks","description":"In this article, we will explain how to rename a database using SQL. 1. Introduction In this article, we will look at one of the Data Definition Language","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/","og_locale":"en_US","og_type":"article","og_title":"SQL Rename Database - Java Code Geeks","og_description":"In this article, we will explain how to rename a database using SQL. 1. Introduction In this article, we will look at one of the Data Definition Language","og_url":"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2020-11-16T09:00:00+00:00","article_modified_time":"2020-11-16T16:54:11+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","type":"image\/jpeg"}],"author":"Reshma Sathe","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Reshma Sathe","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/"},"author":{"name":"Reshma Sathe","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/079aa9a12c7b8ebea3391ebeb6036a74"},"headline":"SQL Rename Database","datePublished":"2020-11-16T09:00:00+00:00","dateModified":"2020-11-16T16:54:11+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/"},"wordCount":1227,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","keywords":["mysql"],"articleSection":["sql"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/sql-rename-database\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/","url":"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/","name":"SQL Rename Database - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","datePublished":"2020-11-16T09:00:00+00:00","dateModified":"2020-11-16T16:54:11+00:00","description":"In this article, we will explain how to rename a database using SQL. 1. Introduction In this article, we will look at one of the Data Definition Language","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/sql-rename-database\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","width":150,"height":150,"caption":"Bipartite Graph"},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/sql-rename-database\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Core Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/"},{"@type":"ListItem","position":4,"name":"sql","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/sql\/"},{"@type":"ListItem","position":5,"name":"SQL Rename Database"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/079aa9a12c7b8ebea3391ebeb6036a74","name":"Reshma Sathe","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/08\/reshma_sathe-96x96.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/08\/reshma_sathe-96x96.png","caption":"Reshma Sathe"},"description":"I am a recent Master of Computer Science degree graduate from the University Of Illinois at Urbana-Champaign.I have previously worked as a Software Engineer with projects ranging from production support to programming and software engineering.I am currently working on self-driven projects in Java, Python and Angular and also exploring other frontend and backend technologies.","sameAs":["www.linkedin.com\/in\/reshma-sathe"],"url":"https:\/\/examples.javacodegeeks.com\/author\/reshma-sathe\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/97085","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/232"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=97085"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/97085\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1204"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=97085"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=97085"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=97085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}