SQL RENAME Table
In this tutorial we will discuss, how can we rename a table?
In order to rename a table you need to mention;
- Mention the name of the existing table which you want to rename.
- Mention a new table name and the new name must not be the same as another table in the same schema.
The renaming table is applicable not only for the table but also for View, sequence, synonym, and all kinds of stuff. So we need to understand when we are going to rename a table. There are a lot of responsibilities. First of all, the table will hold the responsibility of constraint. It might have constraints like a primary key or a foreign key or something else like that.
So when we are going to rename that particular table, we should ensure that whether all these Integrity constraints or the permissions relevant to the tables are safely transferred or not. So this is a very important command that we have to ensure multiple times before we give this command at the database level.
So all the things that you have to just look follow as a part of the procedural pattern or the business process and why you are working with the database.
We are going to change users table name to authors table name.
Syntax:
rename table_name TO new_name;
Example:
rename users to authors;
Output:

So now you are able to see authors are the other table name, which was renamed from the users .So this is how that we can rename the table.