RENAME TABLE command in SQL

Sometimes we need to change the name of the table in the SQL database because we want to give a more relevant name to the table. The RENAME TABLE command in SQL is used to rename an existing table. However, the exact syntax and capabilities for renaming tables can vary between different SQL database management systems (DBMS). Here are examples for some popular DBMS:

SQL Syntax

RENAME TABLE old_table_name TO new_table_name;

Example: The following command renames the employees table to staff.

SQL

RENAME TABLE employees TO staff;