mysql

Rename table MySQL

RENAME TABLE statement is used to change that the name of a single table or multiple tables.

-- SINGLE TABLE
RENAME TABLE courses TO subjects;

-- MULTIPLE TABLES
RENAME TABLE 
    courses TO subjects,
    topics TO subject_topics;

In the code snippet, we are renaming or changing the name of a table from 'courses' to 'subjects'. We can also change multiple table names with a single query.

Was this helpful?