{"id":3586,"date":"2026-10-07T14:27:14","date_gmt":"2026-10-07T14:27:14","guid":{"rendered":"https:\/\/www.ucartz.com\/blog\/rename-table-sql\/"},"modified":"2026-10-07T14:27:23","modified_gmt":"2026-10-07T14:27:23","slug":"rename-table-sql","status":"publish","type":"post","link":"https:\/\/www.ucartz.com\/blog\/rename-table-sql\/","title":{"rendered":"How to Rename a Table in SQL: MySQL, PostgreSQL and SQL Server"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Short answer:<\/strong> in MySQL and MariaDB, use <code>RENAME TABLE old_name TO new_name;<\/code>. In PostgreSQL and SQLite, use <code>ALTER TABLE old_name RENAME TO new_name;<\/code>. In SQL Server, use <code>EXEC sp_rename 'dbo.old_name', 'new_name';<\/code>. Renaming is quick because the data is not copied, but it can break anything that still uses the old name: views, application code, stored queries and, in WordPress, user roles. Take a backup first and check what refers to the table. We ran every command below on MySQL 8.4.11, MariaDB 11.8.9, PostgreSQL 18.6 and SQLite 3.46.1.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"584\" src=\"https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/10\/rename-table-sql-screenshot-1024x584.png\" alt=\"Terminal showing RENAME TABLE renaming customers to clients on MariaDB 11.8.9, with the rows kept\" class=\"wp-image-3588\" srcset=\"https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/10\/rename-table-sql-screenshot-1024x584.png 1024w, https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/10\/rename-table-sql-screenshot-300x171.png 300w, https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/10\/rename-table-sql-screenshot-768x438.png 768w, https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/10\/rename-table-sql-screenshot.png 1100w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">RENAME TABLE on MariaDB 11.8.9: the table gets its new name and keeps its rows.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">The syntax for each database<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Database<\/th><th>Command<\/th><th>Notes<\/th><\/tr><\/thead><tbody><tr><td>MySQL<\/td><td><code>RENAME TABLE customers TO clients;<\/code><\/td><td><code>ALTER TABLE customers RENAME TO clients;<\/code> also works<\/td><\/tr><tr><td>MariaDB<\/td><td><code>RENAME TABLE customers TO clients;<\/code><\/td><td>Also accepts <code>RENAME TABLE IF EXISTS<\/code><\/td><\/tr><tr><td>PostgreSQL<\/td><td><code>ALTER TABLE customers RENAME TO clients;<\/code><\/td><td><code>ALTER TABLE IF EXISTS<\/code> skips a missing table<\/td><\/tr><tr><td>SQLite<\/td><td><code>ALTER TABLE customers RENAME TO clients;<\/code><\/td><td>Updates views and foreign keys that refer to it<\/td><\/tr><tr><td>SQL Server<\/td><td><code>EXEC sp_rename 'dbo.customers', 'clients';<\/code><\/td><td>The new name is a one-part name, without <code>dbo.<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">You need the right privileges. The <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.4\/en\/rename-table.html\" target=\"_blank\" rel=\"noopener noreferrer\">MySQL manual<\/a> lists <code>ALTER<\/code> and <code>DROP<\/code> on the old table plus <code>CREATE<\/code> and <code>INSERT<\/code> for the new name. If you get an access denied error on shared hosting, check the privileges your database user has been given in the control panel.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">MySQL and MariaDB<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A plain rename:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RENAME TABLE customers TO clients;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>RENAME TABLE<\/code> can rename several tables in one statement, working left to right. MySQL documents that the operation is atomic: no other session can use the tables while it runs, and if any part fails, nothing changes. That makes it the right tool for swapping in a freshly built copy of a table:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE TABLE products_new LIKE products;\n-- fill products_new, check it, then:\nRENAME TABLE products TO products_old, products_new TO products;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After the swap, <code>SELECT * FROM products<\/code> returned the new rows straight away. For MariaDB, its <a href=\"https:\/\/mariadb.com\/docs\/server\/reference\/sql-statements\/data-definition\/rename-table\" target=\"_blank\" rel=\"noopener noreferrer\">documentation<\/a> says the statement has been atomic for InnoDB, MyISAM and Aria since 10.6.1.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can also move a table into another database on the same server by naming the database:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RENAME TABLE shop.products_old TO archive.old_products;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That worked, but the same move failed for a table with a trigger:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ERROR 1435 (HY000): Trigger in wrong schema<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">What happens to foreign keys and views<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">We created an <code>orders<\/code> table with a foreign key to <code>customers<\/code>, and a view that joins the two. After <code>RENAME TABLE customers TO clients<\/code>, InnoDB had updated the foreign key by itself:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CONSTRAINT `orders_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `clients` (`id`)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The view was not updated. Both MySQL and MariaDB returned this when we queried it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ERROR 1356 (HY000): View 'shop.order_list' references invalid table(s) or column(s) or function(s) or definer\/invoker of view lack rights to use them<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The fix is to recreate the view with the new table name using <code>CREATE OR REPLACE VIEW<\/code>. Also note that, according to the MySQL manual, privileges granted on the old table name are not moved to the new name.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">MySQL errors you might see<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>ERROR 1146 (42S02): Table 'shop.missing' doesn't exist<\/code>: a typo, or the wrong database is selected.<\/li>\n\n\n\n<li><code>ERROR 1050 (42S01): Table 'orders' already exists<\/code>: the new name is taken. Rename or drop the other table first.<\/li>\n\n\n\n<li><code>ERROR 1064 (42000)<\/code> on <code>RENAME TABLE IF EXISTS<\/code>: MySQL 8.4 does not support <code>IF EXISTS<\/code> here; MariaDB does, and only returns a note if the table is missing.<\/li>\n\n\n\n<li><code>Table 'shop.Customers' doesn't exist<\/code> when the table is <code>customers<\/code>: on Linux, with the default <code>lower_case_table_names=0<\/code>, table names are case-sensitive. Code written on Windows or macOS often trips over this after moving to a Linux server.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">PostgreSQL<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>ALTER TABLE customers RENAME TO clients;\nALTER TABLE IF EXISTS missing RENAME TO x;\n-- NOTICE:  relation \"missing\" does not exist, skipping<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">PostgreSQL behaved differently from MySQL with the same test tables. The view kept working, and <code>pg_get_viewdef<\/code> showed it now read <code>JOIN clients c<\/code>, because PostgreSQL views point at the table itself rather than its name. Two things kept their old names, though: the sequence behind the <code>SERIAL<\/code> column (<code>nextval('customers_id_seq'::regclass)<\/code>) and the primary key index (<code>customers_pkey<\/code>). They still work, but you can rename them too if you want consistent names. New rows still got their IDs from the renamed sequence in our test:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ALTER SEQUENCE customers_id_seq RENAME TO clients_id_seq;\nALTER INDEX customers_pkey RENAME TO clients_pkey;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To move a table into another schema, use <code>SET SCHEMA<\/code>. Putting a schema in the new name, as in <code>RENAME TO archive.customers<\/code>, is a syntax error. The <a href=\"https:\/\/www.postgresql.org\/docs\/current\/sql-altertable.html\" target=\"_blank\" rel=\"noopener noreferrer\">ALTER TABLE reference<\/a> covers both forms.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ALTER TABLE clients SET SCHEMA archive;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">SQL Server<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">SQL Server uses a stored procedure. We could not run SQL Server in our test environment, so this part is taken from <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/relational-databases\/system-stored-procedures\/sp-rename-transact-sql\" target=\"_blank\" rel=\"noopener noreferrer\">Microsoft&#8217;s sp_rename reference<\/a>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>EXEC sp_rename 'Sales.SalesTerritory', 'SalesTerr';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">According to Microsoft, the new name must be a one-part name, so do not repeat the schema in the second argument. Renaming does not update views, stored procedures or triggers that refer to the table; Microsoft suggests listing them first with <code>sys.sql_expression_dependencies<\/code>. In SQL Server Management Studio, Microsoft&#8217;s steps are: right-click the table in Object Explorer, choose Design, open View, then Properties, change the Name and save. If you do not have SSMS yet, see <a href=\"https:\/\/www.ucartz.com\/clients\/knowledgebase\/9277\/How-to-Install-SQL-Server-Management-Studio-SSMS-and-Connect-to-SQL-Server.html\">how to install SQL Server Management Studio<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Real example: changing the WordPress table prefix<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A common reason to rename tables on a hosting account is changing WordPress&#8217;s <code>wp_<\/code> prefix, for example when two sites share one database. We tested it on WordPress 7.1.2 with MariaDB. Renaming the tables and changing <code>$table_prefix<\/code> in <code>wp-config.php<\/code> was not enough: the site loaded, but <code>wp user list<\/code> showed the admin user with no role, and the dashboard said:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Sorry, you are not allowed to access this page.<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">WordPress stores the role definitions and each user&#8217;s roles under keys that include the prefix. These two statements fixed it, and the admin role and dashboard came straight back (here the new prefix is <code>wpx_<\/code>):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>UPDATE wpx_options SET option_name = 'wpx_user_roles'\n  WHERE option_name = 'wp_user_roles';\nUPDATE wpx_usermeta SET meta_key = CONCAT('wpx_', SUBSTRING(meta_key, 4))\n  WHERE meta_key LIKE 'wp\\_%';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Do not rename every option that starts with <code>wp_<\/code>. Our test database also had options such as <code>wp_page_for_privacy_policy<\/code> and <code>wp_force_deactivated_plugins<\/code>, which start with <code>wp_<\/code> by name, not because of the table prefix. Only <code>wp_user_roles<\/code> needs changing in the options table.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Checklist before you rename a table<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Back up the database.<\/strong> On cPanel, see <a href=\"https:\/\/www.ucartz.com\/clients\/knowledgebase\/326\/How-can-I-backup-a-database-using-phpmyadmin.html\">how to back up a database with phpMyAdmin<\/a>.<\/li>\n\n\n\n<li><strong>Find everything that uses the name:<\/strong> application code, views, triggers, stored procedures, cron jobs and reports. <code>grep -r \"customers\" \/path\/to\/app<\/code> is a quick start.<\/li>\n\n\n\n<li><strong>Stop writes or use a maintenance window<\/strong> if the application updates the table constantly.<\/li>\n\n\n\n<li><strong>Rename, then update the code<\/strong> and recreate any views that broke.<\/li>\n\n\n\n<li><strong>Test the application<\/strong>, including logins and admin pages, not just the home page.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">On cPanel hosting you can run these statements from the SQL tab in phpMyAdmin: see <a href=\"https:\/\/www.ucartz.com\/clients\/knowledgebase\/343\/Running-SQL-Queries-on-a-Database-with-phpMyAdmin.html\">running SQL queries with phpMyAdmin<\/a>. To rename a whole database rather than a table, cPanel has its own tool: <a href=\"https:\/\/www.ucartz.com\/clients\/knowledgebase\/7028\/How-to-Rename-a-Database-in-cPanel.html\">how to rename a database in cPanel<\/a>. And if you would rather have someone else plan a risky schema change on a live site, our <a href=\"https:\/\/www.ucartz.com\/hire-an-expert\">engineers are available by the hour<\/a>.<\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>Rename a table in MySQL, MariaDB, PostgreSQL, SQLite and SQL Server, what happens to views and foreign keys, and how to change the WordPress table prefix.<\/p>\n","protected":false},"author":11,"featured_media":3587,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[389,400],"tags":[1005,1002,1001,1003,1000,999,1004,499],"class_list":["post-3586","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","category-tutorials","tag-database","tag-mariadb","tag-mysql","tag-postgresql","tag-rename-table","tag-sql","tag-sql-server","tag-wordpress"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":8}},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Rename a Table in SQL: MySQL, PostgreSQL, SQL Server - Ucartz Blog<\/title>\n<meta name=\"description\" content=\"Rename a table in MySQL, MariaDB, PostgreSQL, SQLite and SQL Server, what happens to views and foreign keys, and how to change the WordPress table prefix.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.ucartz.com\/blog\/rename-table-sql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Rename a Table in SQL: MySQL, PostgreSQL, SQL Server - Ucartz Blog\" \/>\n<meta property=\"og:description\" content=\"Rename a table in MySQL, MariaDB, PostgreSQL, SQLite and SQL Server, what happens to views and foreign keys, and how to change the WordPress table prefix.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.ucartz.com\/blog\/rename-table-sql\/\" \/>\n<meta property=\"og:site_name\" content=\"Ucartz Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/UcartzOnline\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-07T14:27:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-10-07T14:27:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/10\/rename-table-sql.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"jijosh at\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ucartz\" \/>\n<meta name=\"twitter:site\" content=\"@ucartz\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"jijosh at\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/rename-table-sql\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/rename-table-sql\\\/\"},\"author\":{\"name\":\"jijosh at\",\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/#\\\/schema\\\/person\\\/2eef9f41e897cdc332ba03de30de2be7\"},\"headline\":\"How to Rename a Table in SQL: MySQL, PostgreSQL and SQL Server\",\"datePublished\":\"2026-10-07T14:27:14+00:00\",\"dateModified\":\"2026-10-07T14:27:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/rename-table-sql\\\/\"},\"wordCount\":932,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/rename-table-sql\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/rename-table-sql.jpg\",\"keywords\":[\"database\",\"mariadb\",\"mysql\",\"postgresql\",\"rename table\",\"sql\",\"sql server\",\"wordpress\"],\"articleSection\":[\"Server\",\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/rename-table-sql\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/rename-table-sql\\\/\",\"url\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/rename-table-sql\\\/\",\"name\":\"Rename a Table in SQL: MySQL, PostgreSQL, SQL Server - Ucartz Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/rename-table-sql\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/rename-table-sql\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/rename-table-sql.jpg\",\"datePublished\":\"2026-10-07T14:27:14+00:00\",\"dateModified\":\"2026-10-07T14:27:23+00:00\",\"description\":\"Rename a table in MySQL, MariaDB, PostgreSQL, SQLite and SQL Server, what happens to views and foreign keys, and how to change the WordPress table prefix.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/rename-table-sql\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/rename-table-sql\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/rename-table-sql\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/rename-table-sql.jpg\",\"contentUrl\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/rename-table-sql.jpg\",\"width\":1200,\"height\":630,\"caption\":\"How to Rename a Table in SQL: MySQL, PostgreSQL and SQL Server\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/rename-table-sql\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Rename a Table in SQL: MySQL, PostgreSQL and SQL Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/\",\"name\":\"Ucartz Blog\",\"description\":\"Guides on hosting, servers, streaming and automation\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/#organization\"},\"alternateName\":\"Ucartz\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/#organization\",\"name\":\"Ucartz Online Pvt Ltd\",\"alternateName\":\"Ucartz\",\"url\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/ucartz-logo-888x240-1.png\",\"contentUrl\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/ucartz-logo-888x240-1.png\",\"width\":888,\"height\":240,\"caption\":\"Ucartz Online Pvt Ltd\"},\"image\":{\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/UcartzOnline\",\"https:\\\/\\\/x.com\\\/ucartz\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/ucartzonline\",\"https:\\\/\\\/www.instagram.com\\\/ucartz_com\",\"https:\\\/\\\/www.trustpilot.com\\\/review\\\/ucartz.com\",\"https:\\\/\\\/n8n.io\\\/creators\\\/ucartz\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/#\\\/schema\\\/person\\\/2eef9f41e897cdc332ba03de30de2be7\",\"name\":\"jijosh at\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/26be19e6db13a4642cb933c187a444d704623d65d5f70f2262d2c614ea42a55e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/26be19e6db13a4642cb933c187a444d704623d65d5f70f2262d2c614ea42a55e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/26be19e6db13a4642cb933c187a444d704623d65d5f70f2262d2c614ea42a55e?s=96&d=mm&r=g\",\"caption\":\"jijosh at\"},\"description\":\"I am a seasoned web hosting strategist and technical writer at Ucartz, specializing in AI, SEO, GPU servers, cloud infrastructure, and VPS hosting solutions. With over 11 years of experience in the hosting industry, he simplifies complex server technologies into actionable insights for developers, businesses, and tech enthusiasts. From performance benchmarking to real-world deployment guides, I am passionate about helping users choose the right infrastructure for modern workloads like AI, gaming, and automation.\",\"url\":\"https:\\\/\\\/www.ucartz.com\\\/blog\\\/author\\\/jijosh-at\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Rename a Table in SQL: MySQL, PostgreSQL, SQL Server - Ucartz Blog","description":"Rename a table in MySQL, MariaDB, PostgreSQL, SQLite and SQL Server, what happens to views and foreign keys, and how to change the WordPress table prefix.","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:\/\/www.ucartz.com\/blog\/rename-table-sql\/","og_locale":"en_US","og_type":"article","og_title":"Rename a Table in SQL: MySQL, PostgreSQL, SQL Server - Ucartz Blog","og_description":"Rename a table in MySQL, MariaDB, PostgreSQL, SQLite and SQL Server, what happens to views and foreign keys, and how to change the WordPress table prefix.","og_url":"https:\/\/www.ucartz.com\/blog\/rename-table-sql\/","og_site_name":"Ucartz Blog","article_publisher":"https:\/\/www.facebook.com\/UcartzOnline","article_published_time":"2026-10-07T14:27:14+00:00","article_modified_time":"2026-10-07T14:27:23+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/10\/rename-table-sql.jpg","type":"image\/jpeg"}],"author":"jijosh at","twitter_card":"summary_large_image","twitter_creator":"@ucartz","twitter_site":"@ucartz","twitter_misc":{"Written by":"jijosh at","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.ucartz.com\/blog\/rename-table-sql\/#article","isPartOf":{"@id":"https:\/\/www.ucartz.com\/blog\/rename-table-sql\/"},"author":{"name":"jijosh at","@id":"https:\/\/www.ucartz.com\/blog\/#\/schema\/person\/2eef9f41e897cdc332ba03de30de2be7"},"headline":"How to Rename a Table in SQL: MySQL, PostgreSQL and SQL Server","datePublished":"2026-10-07T14:27:14+00:00","dateModified":"2026-10-07T14:27:23+00:00","mainEntityOfPage":{"@id":"https:\/\/www.ucartz.com\/blog\/rename-table-sql\/"},"wordCount":932,"commentCount":0,"publisher":{"@id":"https:\/\/www.ucartz.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.ucartz.com\/blog\/rename-table-sql\/#primaryimage"},"thumbnailUrl":"https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/10\/rename-table-sql.jpg","keywords":["database","mariadb","mysql","postgresql","rename table","sql","sql server","wordpress"],"articleSection":["Server","Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.ucartz.com\/blog\/rename-table-sql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.ucartz.com\/blog\/rename-table-sql\/","url":"https:\/\/www.ucartz.com\/blog\/rename-table-sql\/","name":"Rename a Table in SQL: MySQL, PostgreSQL, SQL Server - Ucartz Blog","isPartOf":{"@id":"https:\/\/www.ucartz.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.ucartz.com\/blog\/rename-table-sql\/#primaryimage"},"image":{"@id":"https:\/\/www.ucartz.com\/blog\/rename-table-sql\/#primaryimage"},"thumbnailUrl":"https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/10\/rename-table-sql.jpg","datePublished":"2026-10-07T14:27:14+00:00","dateModified":"2026-10-07T14:27:23+00:00","description":"Rename a table in MySQL, MariaDB, PostgreSQL, SQLite and SQL Server, what happens to views and foreign keys, and how to change the WordPress table prefix.","breadcrumb":{"@id":"https:\/\/www.ucartz.com\/blog\/rename-table-sql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.ucartz.com\/blog\/rename-table-sql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.ucartz.com\/blog\/rename-table-sql\/#primaryimage","url":"https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/10\/rename-table-sql.jpg","contentUrl":"https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/10\/rename-table-sql.jpg","width":1200,"height":630,"caption":"How to Rename a Table in SQL: MySQL, PostgreSQL and SQL Server"},{"@type":"BreadcrumbList","@id":"https:\/\/www.ucartz.com\/blog\/rename-table-sql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.ucartz.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Rename a Table in SQL: MySQL, PostgreSQL and SQL Server"}]},{"@type":"WebSite","@id":"https:\/\/www.ucartz.com\/blog\/#website","url":"https:\/\/www.ucartz.com\/blog\/","name":"Ucartz Blog","description":"Guides on hosting, servers, streaming and automation","publisher":{"@id":"https:\/\/www.ucartz.com\/blog\/#organization"},"alternateName":"Ucartz","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.ucartz.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.ucartz.com\/blog\/#organization","name":"Ucartz Online Pvt Ltd","alternateName":"Ucartz","url":"https:\/\/www.ucartz.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.ucartz.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/09\/ucartz-logo-888x240-1.png","contentUrl":"https:\/\/www.ucartz.com\/blog\/wp-content\/uploads\/2026\/09\/ucartz-logo-888x240-1.png","width":888,"height":240,"caption":"Ucartz Online Pvt Ltd"},"image":{"@id":"https:\/\/www.ucartz.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/UcartzOnline","https:\/\/x.com\/ucartz","https:\/\/www.linkedin.com\/company\/ucartzonline","https:\/\/www.instagram.com\/ucartz_com","https:\/\/www.trustpilot.com\/review\/ucartz.com","https:\/\/n8n.io\/creators\/ucartz\/"]},{"@type":"Person","@id":"https:\/\/www.ucartz.com\/blog\/#\/schema\/person\/2eef9f41e897cdc332ba03de30de2be7","name":"jijosh at","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/26be19e6db13a4642cb933c187a444d704623d65d5f70f2262d2c614ea42a55e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/26be19e6db13a4642cb933c187a444d704623d65d5f70f2262d2c614ea42a55e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/26be19e6db13a4642cb933c187a444d704623d65d5f70f2262d2c614ea42a55e?s=96&d=mm&r=g","caption":"jijosh at"},"description":"I am a seasoned web hosting strategist and technical writer at Ucartz, specializing in AI, SEO, GPU servers, cloud infrastructure, and VPS hosting solutions. With over 11 years of experience in the hosting industry, he simplifies complex server technologies into actionable insights for developers, businesses, and tech enthusiasts. From performance benchmarking to real-world deployment guides, I am passionate about helping users choose the right infrastructure for modern workloads like AI, gaming, and automation.","url":"https:\/\/www.ucartz.com\/blog\/author\/jijosh-at\/"}]}},"_links":{"self":[{"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/posts\/3586","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/comments?post=3586"}],"version-history":[{"count":1,"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/posts\/3586\/revisions"}],"predecessor-version":[{"id":3589,"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/posts\/3586\/revisions\/3589"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/media\/3587"}],"wp:attachment":[{"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/media?parent=3586"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/categories?post=3586"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ucartz.com\/blog\/wp-json\/wp\/v2\/tags?post=3586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}