In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article is about how mysql removes fields. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
In mysql, you can use the "ALTER TABLE" statement and the "DROP" keyword to remove the specified field. The syntax is "ALTER TABLE data table name DROP field name;", "field name" refers to the name of the field that needs to be removed from the table.
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
In mysql, you can use the "ALTER TABLE" statement and the "DROP" keyword to remove the specified field.
ALTER TABLE statement to change the structure of the original table, such as adding or deleting columns, changing the original column type, renaming columns or tables, and so on.
The drop statement removes the structure of the table, as well as dependent constraints (constrain), triggers (trigger), and indexes (index).
To remove a field is to remove a field from the data table. The syntax format is as follows:
ALTER TABLE Datasheet name DROP field name
Where Field name refers to the name of the field that needs to be deleted from the table.
Example: remove the deptId field from the tb_emp data table
First look at the data of the tb_emp data table
Mysql > DESC tb_emp +-+-+ | Field | Type | Null | Key | Default | Extra | + -+ | id | int (11) | YES | | NULL | name | varchar (30) | YES | | NULL | | deptId | int (11) | YES | | NULL | | salary | float | YES | | NULL | | + -+ 5 rows in set (0.01 sec)
Remove deptId field
Mysql > ALTER TABLE tb_emp-> DROP deptId;Query OK, 0 rows affected (.53 sec) Records: 0 Duplicates: 0 Warnings: 0
View the new data after removing the field
Mysql > DESC tb_emp +-+-+ | Field | Type | Null | Key | Default | Extra | + -+ | id | int (11) | YES | | NULL | | name | varchar (30) | YES | | NULL | | salary | float | YES | | NULL | | +-+-+ 5 Rows in set (0.00 sec) Thank you for your reading! This is the end of this article on "how to remove fields from mysql". 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, you can 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.
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.