At 15:38, 19990807, Anna Winkler wrote:
>When I create a key or index, the value shown in the key field is MUL.
>What does MUL mean? Is there any way to determine if the field is a key
>or index?
There is no difference between KEY and INDEX - they are synonyms.
MUL means that the key allows multiple rows to have the same value.
That is, it's not a UNIque key.
Tim
>I created a test table with:
>
>mysql> create table key_test (key1 char(10) not null, key2 char(5) not null, index1
> int not null, field4 char(12) not null, primary key (key1), key (key2), index (index1),
> unique (field4));
>Query OK, 0 rows affected (0.01 sec)
>
>So then I have this table:
>
>mysql> describe key_test;
>+--------+----------+------+-----+---------+-------+
>| Field | Type | Null | Key | Default | Extra |
>+--------+----------+------+-----+---------+-------+
>| key1 | char(10) | | PRI | | |
>| key2 | char(5) | | MUL | | |
>| index1 | int(11) | | MUL | 0 | |
>| field4 | char(12) | | UNI | | |
>+--------+----------+------+-----+---------+-------+
>
>I tried a show index:
>
>mysql> show index from key_test;
>+----------+------------+----------+--------------+-------------+-----------+-------------+----------+
>| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation |
> Cardinality | Sub_part |
>+----------+------------+----------+--------------+-------------+-----------+-------------+----------+
>| key_test | 0 | PRIMARY | 1 | key1 | A |
> 0 | NULL |
>| key_test | 1 | key2 | 1 | key2 | A |
> NULL | NULL |
>| key_test | 1 | index1 | 1 | index1 | A |
> NULL | NULL |
>| key_test | 0 | field4 | 1 | field4 | A |
> 0 | NULL |
>+----------+------------+----------+--------------+-------------+-----------+-------------+----------+
>4 rows in set (0.00 sec)
>
>But it still isn't clear to me how I know key2 is a KEY and index1 is an INDEX?
>
>Thanks for your help,
>Anna Winkler