Heim >Datenbank >MySQL-Tutorial >mysql创建单个和联合索引

mysql创建单个和联合索引

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 15:20:301216Durchsuche

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入 首先创建一个表:create table t1 (id int primary key,username varchar(20),password varchar(20)); 创建单个索引的语法:create index 索引名 on 表名(字段名) 索引名一般是:表名_字段

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入

  首先创建一个表:create table t1 (id int primary key,username varchar(20),password varchar(20));

  创建单个索引的语法:create index 索引名 on 表名(字段名)

  索引名一般是:表名_字段名

  给id创建索引:create index t1_id on t1(id);

  创建联合索引的语法:create index 索引名 on 表名(字段名1,字段名2)

  给username和password创建联合索引:create index t1_username_password on t1(username,password)

mysql创建单个和联合索引

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:SQLSERVER DBA容易犯的十个错误Nächster Artikel:OpenCL心得2