diff --git a/src/data/roadmaps/sql/content/102-ddl/index.md b/src/data/roadmaps/sql/content/102-ddl/index.md index 3e9c43e15..ff56b04ff 100644 --- a/src/data/roadmaps/sql/content/102-ddl/index.md +++ b/src/data/roadmaps/sql/content/102-ddl/index.md @@ -35,9 +35,15 @@ Data Definition Language (DDL) is a subset of SQL. Its primary function is to cr 5. `RENAME`: This is used to rename an object in the database. ```sql - RENAME TABLE old_table_name TO new_table_name; + -- To rename a table + ALTER TABLE table_name + RENAME TO new_table_name; + + -- To rename a column + ALTER TABLE table_name + RENAME COLUMN old_column_name TO new_column_name; ``` Remember: In DDL operations, `COMMIT` and `ROLLBACK` statement cannot be performed because the MySQL engine automatically commits the changes. -Remember to replace `table_name`, `column_name`, `datatype(size)`, `old_table_name`, and `new_table_name` in the examples above with your actual table names, column names, data types and sizes, and the old or new table names you want to specify. \ No newline at end of file +Remember to replace `table_name`, `column_name`, `datatype(size)`, `old_table_name`, and `new_table_name` in the examples above with your actual table names, column names, data types and sizes, and the old or new table names you want to specify.