1DROP TABLE IF EXISTS items; 2CREATE TABLE items ( 3id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, 4score1 INT, 5score2 INT, 6score3 INT, 7INDEX (score1, score2, score3) 8) DEFAULT CHARSET=UTF8; 9SHOW CREATE TABLE items; 10Table Create Table 11items CREATE TABLE `items` ( 12 `id` int(11) NOT NULL AUTO_INCREMENT, 13 `score1` int(11) DEFAULT NULL, 14 `score2` int(11) DEFAULT NULL, 15 `score3` int(11) DEFAULT NULL, 16 PRIMARY KEY (`id`), 17 KEY `score1` (`score1`,`score2`,`score3`) 18) ENGINE=Mroonga DEFAULT CHARSET=utf8 19INSERT INTO items (score1, score2, score3) VALUES(1, 10, -100); 20INSERT INTO items (score1, score2, score3) VALUES(1, 10, 0); 21INSERT INTO items (score1, score2, score3) VALUES(2, 10, 100); 22INSERT INTO items (score1, score2, score3) VALUES(2, 30, -100); 23INSERT INTO items (score1, score2, score3) VALUES(2, 30, 0); 24INSERT INTO items (score1, score2, score3) VALUES(2, 30, 100); 25INSERT INTO items (score1, score2, score3) VALUES(2, 20, -100); 26INSERT INTO items (score1, score2, score3) VALUES(2, 20, 0); 27INSERT INTO items (score1, score2, score3) VALUES(2, 20, 100); 28SELECT * 29FROM items 30WHERE score1 = 2 31ORDER BY score2 DESC, score3 DESC; 32id score1 score2 score3 336 2 30 100 345 2 30 0 354 2 30 -100 369 2 20 100 378 2 20 0 387 2 20 -100 393 2 10 100 40DROP TABLE items; 41