Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How mysql modifies column properties

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail how to modify the column properties of mysql. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

In mysql, you can use the "ALTER TABLE table name MODIFY COLUMN column name changed column properties" statement to modify column properties, where the ALTER command is used to modify data table names or data table fields. When the parameter is set to an attribute value, the data properties of the specified column are modified.

The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.

In mysql, to modify column properties, you can use the alter command.

Modify the field type:

Delete column: ALTER TABLE [table name] DROP [column name]

Add column: ALTER TABLE [table name] ADD [column name] INT NOT NULL COMMENT 'comment description'

Modify the type information of the column: ALTER TABLE [table name] CHANGE [column name] [new column name (here you can use the same name as the original column)] BIGINT NOT NULL COMMENT 'comment description'

Rename column: ALTER TABLE [table name] CHANGE [column name] [new column name] BIGINT NOT NULL COMMENT 'comment description'

Rename table: ALTER TABLE table name RENAME table new name

Delete the primary key in the table: Alter TABLE [Table name] drop primary key

On "mysql how to modify column properties" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report