List:General Discussion« Previous MessageNext Message »
From:Sasha Pachev Date:August 7 1999 10:19pm
Subject:Re: Key Field MUL (Newbie Question)
View as plain text  
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?
> 
> 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
> 

You can think of INDEX as being synonymous with KEY for the purpose of
simplicity.

A field is really never an index, but it can be a part of an index. Very
often an index consist of only one field, and we call that field a key,
although strictly speaking this is not correct - we should say that we
have a key consisting of the field.

MUL means that the field is a part of an index that has other fields.

-- 
Sasha Pachev
http://www.sashanet.com
Thread
Key Field MUL (Newbie Question)Anna Winkler7 Aug
  • Re: Key Field MUL (Newbie Question)Thimble Smith7 Aug
  • Re: Key Field MUL (Newbie Question)Sasha Pachev8 Aug
    • Re: Key Field MUL (Newbie Question)Thimble Smith8 Aug