mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-10 19:26:03 +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:
@@ -35,7 +35,13 @@ 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.
|
5. `RENAME`: This is used to rename an object in the database.
|
||||||
|
|
||||||
```sql
|
```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: In DDL operations, `COMMIT` and `ROLLBACK` statement cannot be performed because the MySQL engine automatically commits the changes.
|
||||||
|
Reference in New Issue
Block a user