From db4b2487f51ed26ce07efe698f05c5e51d828269 Mon Sep 17 00:00:00 2001 From: Ashutosh Kumar Date: Sat, 11 May 2024 06:35:51 +0530 Subject: [PATCH] Update queries (#5143) * Update index.md added correct syntax for renaming table or column * Update src/data/roadmaps/sql/content/102-ddl/index.md * Update src/data/roadmaps/sql/content/102-ddl/index.md * Update src/data/roadmaps/sql/content/102-ddl/index.md * Update src/data/roadmaps/sql/content/102-ddl/index.md * Update src/data/roadmaps/sql/content/102-ddl/index.md --------- Co-authored-by: Kamran Ahmed --- src/data/roadmaps/sql/content/102-ddl/index.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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.