In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
When a data table has been deleted many times, its self-increment column will be very chaotic and unattractive, so we need to reorder it so that it starts from 1 again.
How to do this: delete the original id field in the data table, and then re-establish the id field
Delete the id field:
Alter table bumen drop id
Rebuild Field:
ALTER TABLE bumen ADD id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY FIRST
-- INT UNSIGNED unsigned integers (pure numbers). FIRST is inserted at the beginning of the table and at the end of the table by default.
-
Custom value-added
The value-added setting starts from 50:
Create table bumen (id int not null primary key auto_increment) auto_increment=50,charset=gbk;-specifies that the language name should be placed outside the parentheses of the field
The modification starts with the increment of 100:
ALTER TABLE bumen AUTO_INCREMENT = 100;-- change the table after it is created
-
Create a department table with three fields: id serial number, department name, and manager:
CREATE TABLE bu5 (
Id INT (5) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY
NAME CHAR (10) NOT NULL UNIQUE
Manger VARCHAR (20) NOT NULL) charset=gbk
-- id pure digit 5-digit, non-null, self-growing, primary key; name 10-bit, non-null, uniqueness constraint, manger adaptive 20-bit, non-null
Add a unique harness to the field:
ALTER TABLE bu5 CHANGENAME NAME CHAR (10) UNIQUE;-redefines the name field
-
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.