MySQL-DDL-table structure-query&modify&delete
Language
2023-07-18 19:16:06
views: null
DDL (table operations)
-
Inquire
- Query all tables in the current database: show tables
- Query table structure: desc + table name
- Query table creation statement: show create table + table name
-
Modify (mainly operated through the graphical interface)
- Add field: alter table table name add field name type (length) [ comment comment ] [constraint]
- Modify the field type: alter table table name modify field name new data type (length)
- Modify the field name and field type: alter table table name change old field name type (length) [ comment comment ] [constraint]
- Delete field: alter table table name drop column field name
- Modify the table name: rename table table name to new table name
-
delete
- Delete table: drop table [ if exists ] table name
- When deleting a table, all statements in the table will be deleted
Origin blog.csdn.net/weixin_64939936/article/details/131753469