1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-07-31 14:30:13 +02:00

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 <kamranahmed.se@gmail.com>
This commit is contained in:
Ashutosh Kumar
2024-05-11 06:35:51 +05:30
committed by GitHub
parent f1fbca6fc9
commit db4b2487f5

View File

@@ -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.
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.