1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| drop table animals_myisam; CREATE TABLE animals_myisam ( grp ENUM('fish','mammal','bird') NOT NULL, id MEDIUMINT NOT NULL AUTO_INCREMENT, name CHAR(30) NOT NULL, PRIMARY KEY (grp,id) ) ENGINE=MyISAM;
INSERT INTO animals_myisam (grp,name) VALUES ('mammal','dog'),('mammal','cat'), ('bird','penguin'),('fish','lax'),('mammal','whale'), ('bird','ostrich');
root@db 03:12: [aaaa]> SELECT * FROM animals_myisam ORDER BY grp,id; +--------+----+---------+ | grp | id | name | +--------+----+---------+ | fish | 1 | lax | | mammal | 1 | dog | | mammal | 2 | cat | | mammal | 3 | whale | | bird | 1 | penguin | | bird | 2 | ostrich | +--------+----+---------+ 6 rows in set (0.00 sec)
root@db 03:12: [aaaa]> INSERT INTO animals_myisam (grp,name) VALUES -> ('mammal','dog'),('mammal','cat'), -> ('bird','penguin'),('fish','lax'),('mammal','whale'), -> ('bird','ostrich'); Query OK, 6 rows affected (0.00 sec) Records: 6 Duplicates: 0 Warnings: 0
root@db 03:13: [aaaa]> INSERT INTO animals_myisam (grp,name) VALUES -> ('mammal','dog'),('mammal','cat'), -> ('bird','penguin'),('fish','lax'),('mammal','whale'), -> ('bird','ostrich'); Query OK, 6 rows affected (0.00 sec) Records: 6 Duplicates: 0 Warnings: 0
root@db 03:13: [aaaa]> SELECT * FROM animals_myisam ORDER BY grp,id; +--------+----+---------+ | grp | id | name | +--------+----+---------+ | fish | 1 | lax | | fish | 2 | lax | | fish | 3 | lax | | mammal | 1 | dog | | mammal | 2 | cat | | mammal | 3 | whale | | mammal | 4 | dog | | mammal | 5 | cat | | mammal | 6 | whale | | mammal | 7 | dog | | mammal | 8 | cat | | mammal | 9 | whale | | bird | 1 | penguin | | bird | 2 | ostrich | | bird | 3 | penguin | | bird | 4 | ostrich | | bird | 5 | penguin | | bird | 6 | ostrich | +--------+----+---------+ 18 rows in set (0.00 sec)
|