您好,登錄后才能下訂單哦!
如題
CREATE TABLE `score` ( `id` int(11) NOT NULL, `studentid` int(11) NOT NULL, `subjectid` int(11) NOT NULL, `score` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- 新建一個索引能夠同時提升三條SQL的查詢性能 ALTER TABLE `score` ADD INDEX `score` ( `score` , `studentid` , `subjectid` ) EXPLAIN SELECT * FROM score WHERE score=100; EXPLAIN SELECT * FROM score WHERE studentid=5 AND score=100; EXPLAIN SELECT * FROM score WHERE studentid=5 AND subjectid=2 AND score=100;
`
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。