In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Data modification of MYSQL
1 add a single column
An ALTER TABLE list name the parameter name (such as age) to be added by ADD (e.g. 21); [at the bottom of all columns]
B ALTER TABLE list name ADD parameter name (such as age) content (such as 21) TIRST; [the newly added column is at the top]
C ALTER TABLE list name ADD parameter name (such as age) content (such as 21) the column specified by AFIER; [the newly added column is below the column you specify]
2 add multiple columns
ALTERTABLE list name ADD parameter name to add (e.g. age) content (e.g. 21); parameter name to be added (e.g. name) content (e.g. Su Linlin); and so on [at the bottom of all columns]
3 delete a single column
ALTEERTABLE list name DROP the name of the parameter to delete (such as age)
4 delete multiple columns
ALTER TABLE list name DROP parameter name to delete (such as name), parameter name to be deleted (such as age), and so on
5 you can also add while deleting
6 add primary key constraint (there can be only one)
The name of the ALTER TABLE list is PRIMARY REY (the name of the primary key constraint to be added); (it is actually the parameter name such as the name)
7 add unique constraints (there can be multiple)
ALTER TABLE list name ADD UNIQUE (the only constraint name to be added); (in fact, the parameter name such as age)
8 add foreign key constraint
ALTERTABLE list name ADD FOREIGN KEY (foreign key parameter) REFRENCES list name (parameter name)
9 add default constraint
ALTER ABLE table name ALTER parameter SET DEFAULT default
10 remove default constraint
ALTER TABLE table name ALTER parameter DROP DEFAULT
11 to see which parameters in the list have constraints and indexes
Step 1 SHOW INDEXES FROM list name
Step 2 SHOW INDEXES FROM list name\ G
12 remove primary key constraint
ALTER TABLE table name DROP PRIMAPY KEY
13 remove unique constraint
ALTER TABLE table name DROP INDEX parameter
14 Delete foreign key constraint
ALTER TABLE table name DROP FOREIGN KEY foreign key constraint name
15 View foreign key constraint name
SHOW CREATE TABLE table name
16 delete index
ALTER TABCE table name DROP INDEX parameter name with index
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.