In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Char (n) or varchar (n) in Mysql, where n represents a column, not bytes!
Varchar (n), where n is at most 65535, should specify that the table is encoded as latin1 when the table is created, because one character in latin1 accounts for 1 byte. In this 65535, there are 2 bytes to store the length of the contents of the column. There is also a byte to store the null value! So there are 65532 bytes left.
Auto_increment automatic growth constraint.
Note that you can't just add a self-growing constraint to a column. To add self-growing, the column must first be a key (primary key constraint or uniqueness constraint).
At this point, when we add data, we don't have to add id, because id will grow on its own!
As you can see, since self-growth, the default is to increase from 1, each increase of 1, these values can be modified.
The type of self-growing column must be a numeric type.
In fact, let id column self-growth, do not have to write down the name of the column, this is too troublesome!
You can define the starting value of self-growth.
1. Colleagues in the definition table specify:
two。 After the table is created, modify the starting value since the growth
Note that this starting value can be modified larger than the current maximum. It will start to grow from the new starting value!
We will now delete the data from the table. Add the data again, and the resulting self-increasing value is followed by the maximum retention value!
Truncate table deletes the table before creating it. (technically called "truncation" table)
The role of the truncated table allows the self-growing column to re-generate the value from the starting value!
Note that after deleting an id, the following id will not "squeeze up"
Uniqueness constraint: the value of the column to which the uniqueness constraint is added cannot be repeated. Unlike a primary key, the value of a uniqueness constraint can be NULL, and there can be multiple uniqueness constraints in a table.
Note that the column of a uniqueness constraint can have null values and multiple null values.
Yi Yue (Shenzhen) Technology Co., Ltd.
Make happiness easier.
Wechat: EJoyYOJOY
Weibo: http://weibo.com/EJoyYOJOY
Official website: http://www.ejoytec.com/
Contact & contribution: service@ejoytec.com
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.