MariaDB root@(none):dyw> show index from dcount\G 0 rows in set Time: 0.004s
MariaDB root@(none):dyw> alter table dcount add index (author); You're about to run a destructive command. Do you want to proceed? (y/n): y Your call! Query OK, 0 rows affected Time: 0.088s
Non_unique: 1 表示不限定「不重複」。
MariaDB root@(none):dyw> show index from dcount\G ***************************[ 1. row ]*************************** Table | dcount Non_unique | 1 Key_name | author Seq_in_index | 1 Column_name | author Collation | A Cardinality | 6 Sub_part | <null> Packed | <null> Null | Index_type | BTREE Comment | Index_comment | 1 row in set Time: 0.006s
MariaDB root@(none):dyw> insert into dcount(author,dcount) values('dywang',12);
Query OK, 1 row affected
Time: 0.013s
MariaDB root@(none):dyw> select * from dcount; +--------+--------+ | author | dcount | +--------+--------+ | dywang | 4 | | jenny | <null> | | linda | 3 | | peter | 2 | | rita | 1 | | sara | <null> | | dywang | 12 | +--------+--------+ 7 rows in set Time: 0.029s