CREATETABLE`typecho_album`(`id`int(10)unsignedNOTNULLauto_increment,`name`text,`mime`varchar(32)defaultNULL,`pixel`text,`size`int(12)unsigneddefault'0',`created`int(10)unsigneddefault'0',`description`text,`url`text,`thumb`text,`public`int(1)unsigneddefault'1',`from`varchar(32)defaultNULL,`category`varchar(32)defaultNULL,PRIMARYKEY(`id`))ENGINE=MyISAMDEFAULTCHARSET=%charset%;這樣一個表要建立一個索引看了不少還是迷糊看看大家的說法檢索方式select*fromtable可能存在的條件wherepublic=1(pubilc只有0和1二個值)wherefrom=xxx(from有3個值)wherecategory=xx(category有1-N個值不確定)wherecreatedxx(這個是重點created是創(chuàng)建時間,通過時間范圍檢索,比如一天,一星期,一個月,一年)以上條件可能都存在可能都不存在也可能其中1個或者多個謝謝!
MySQL 建表 如何建立索引更有利
www說
2019-04-09 20:24:39