In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly uses examples to analyze Mysql index types and basic usage, the content is simple and easy to understand, I hope you can learn, after learning, there will be a harvest, the following let the editor to take a look at it.
This paper illustrates the type and basic usage of Mysql index. Share with you for your reference, the details are as follows:
Indexes
MySQL currently has the following main index types:
General index unique index primary key index composite index full-text index-general index
Is the most basic index, it does not have any restrictions.
CREATE INDEX IndexName ON `TableName` (`Field name `(length))-unique index
Similar to the previous normal index, except that the value of the index column must be unique, but null values are allowed. If it is a combined index, the combination of column values must be unique.
CREATE UNIQUE INDEX indexName ON table (column (length))-Primary key index
Is a special unique index where a table can have only one primary key and no null values are allowed. Generally, the primary key index is created at the same time when the table is created.
CREATE TABLE `table` (`id` int (11) NOT NULL AUTO_INCREMENT, `title` char (255) NOT NULL, PRIMARY KEY (`id`));-combined index
An index created on multiple fields, which is used only if the first field when the index was created is used in the query condition. Follow the leftmost prefix set when using a combined index
ALTER TABLE `table` ADD INDEX name_city_age (name,city,age);-full-text index
It is mainly used to find keywords in the text, rather than comparing them directly to the values in the index. The fulltext index is very different from other indexes in that it is more like a search engine than a simple parameter match for a where statement. Fulltext indexes are used with match against operations, rather than normal where statements plus like. It can be used in create table,alter table and create index, but currently only full-text indexes can be created on char and varchar,text columns. It is worth mentioning that when the amount of data is large, it is much faster to put the data into a table without a global index, and then create a fulltext index with CREATE index than to create a fulltext for a table and then write the data.
CREATE TABLE `table` (`id` int (11) NOT NULL AUTO_INCREMENT, `title` char (255) CHARACTER NOT NULL, `content` text CHARACTER NULL, `time` int (10) NULL DEFAULT NULL, PRIMARY KEY (`id`), FULLTEXT (content)). The above is about parsing Mysql index types and basic usage with examples. If you have learned knowledge or skills, you can share it 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.