In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces mysql how to change the order of columns, the article is very detailed, has a certain reference value, interested friends must read it!
Mysql changes the order of the columns by first opening the data table, and then putting id in front of the data, with the syntax [alter table table name modify field name field type after field].
Mysql's method of changing the order of columns:
Create a data table like this and want to put id in the first column because it is a primary key and is self-incrementing:
Mysql > select * from student
The original order is shown above, how to put id in front, and the data does not move, the attributes remain the same? Don't talk too much nonsense, just put on the sentence:
Alter table table name modify field name field type after field
Mysql > alter table student modify id int (10) unsigned auto_increment first
This is the first place. What if you want to put name after id? Just write it this way (first can be replaced with after):
Mysql > alter table student modify name varchar (10) after id
Extension:
You can also modify it using change.
Adjust the order of the fields:
Alter table table name change field name new field name field type default after field name (after which field to skip)
Example:
Alter table T1 change Z1 rename_z1 varchar (50) default null AFTER Z5 and above is all about how mysql changes the order of the columns. Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.