SQL RENAME TABLE: A Complete Guide

SQL RENAME TABLE
SQL RENAME TABLE

SQL RENAME TABLE

Sometimes you need to rename a table to give it a more appropriate name. SQL provides the RENAME TABLE and ALTER TABLE statements to do this easily.

Complete Advance AI Topics: Click Here
SQL Tutorial:
Click Here

Method 1: RENAME Statement

RENAME old_table_name TO new_table_name;

-- Example
RENAME Vehicles TO Vehicle_Inventory_2025;

Method 2: ALTER TABLE Statement

ALTER TABLE old_table_name RENAME TO new_table_name;

-- Example
ALTER TABLE Products RENAME TO Product_Inventory;

Syntax Across Databases

-- MySQL
RENAME TABLE Students TO Student_Records;

-- SQL Server (uses stored procedure)
EXEC sp_rename 'Students', 'Student_Records';

-- PostgreSQL / Oracle
ALTER TABLE Students RENAME TO Student_Records;

Things to Remember

  • Renaming may break views, stored procedures, or app code referencing the old name.
  • Ensure the new name does not already exist.
  • You need appropriate privileges to rename a table.

Download New Real Time Projects:- Click here

Conclusion

Renaming tables keeps your database clear and intuitive. Use RENAME TABLE or ALTER TABLE ... RENAME TO depending on your database. For more SQL tutorials, visit .

mysql rename table
rename table name in sql w3schools
sql rename table postgres
alter table rename
sp_rename sql server

Written by Rishabh Saini Founder, UpdateGadh

Rishabh Saini is the founder of UpdateGadh. He has 5 years of experience building PHP, Python, Java, AI and ML projects, and works on projects with the latest and trending technologies. He has helped 2,000+ BCA, MCA and B.Tech students with final year projects. Every project on UpdateGadh is built and tested by him before it is published.

Leave a Reply

Your email address will not be published. Required fields are marked *