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

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly introduces the relevant knowledge of "how mysql modifies column". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to modify column in mysql" can help you solve the problem.

Methods: 1, modify the data type with "alter table table name modify column column name dateType" statement; 2, use "alter table table name change old column name new column name type (length)" statement to modify the name.

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

How does mysql modify column

1. Modify the data type of the field

Alter table table_name modify column column_name dateType

Examples are as follows:

2. Modify the field name

Alter table table_name change old_column_name new_column_name int (11)

Expand knowledge:

1. Add a unique key

Alter table table_name add unique key `uniq_ column` (`column`)

2. Add a field

Alter table table_name add column column_name datatype

3. Delete a field

ALTER TABLE table_name DROP COLUMN column_name

4. Add columns

-alter table students add column column name column attribute alter table students add column language varchar (4) NOT NULL

-added to the end of the column by default

The after column name is added after the specified column name

FIRST is added to the first column

Note: the mysql5.7.16 version does not seem to support SECOND,THIRD...

Alter table students add column Mathematical varchar (4) NOT NULL after birth date

5. Delete columns

-alter table table name drop column lists alter table students drop column scores; this is the end of the introduction on "how mysql modifies column". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

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