Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Index type of mysql database

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Description of index types:

Primary key index

Primary key () requires that keywords cannot be repeated or null, and cannot be named when primary key constraint primary key index definition is added.

Unique index

Unique index () requires that keywords cannot be repeated and adds unique constraints.

General index

Index () has no requirements for keywords

Full-text index

The source of the fulltext key () keyword is not the data of all fields, but the special keywords extracted from the field

Keyword: it can be a field or multiple fields, and multiple fields are called composite indexes.

Example:

Table creation: creat table student (stu_id int unsigned not null auto_increment, name varchar (32) not null default'', phone char (11) not null default'', stu_code varchar (32) not null default'', stu_desc text, primary key ('stu_id'), / / primary key index unique index' stu_code' ('stu_code'), / / unique index index' name_phone' ('name') 'phone'), / / General index Composite index fulltext index 'stu_desc' (' stu_desc'), / / full-text index) engine=myisam charset=utf8 Update: alert table student add primary key ('stu_id'), / / primary key index add unique index' stu_code' ('stu_code'), / / unique index add index' name_phone' ('name','phone'), / / general index, composite index add fulltext index' stu_desc' ('stu_desc') / / full-text index deletion: alert table sutdent drop primary key, drop index 'stu_code', drop index' name_phone', drop index 'stu_desc'

These are the details of the introduction of mysql index types, please pay more attention to other related articles!

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report