Q

Creating a table with a MUL column

What is the syntax to create a table in which a field will have MUL as the key?

MUL is displayed when you use the DESCRIBE statement to get information on a table. MUL simply means that an index

allows non-unique values to be present. Even if a column has a UNQIUE key, it can still be designated MUL if NULL values are allowed (since you could have multiple NULL values in the column).

So to create a table that will have a column that is MUL, just declare it to have a non-unique index, or a unique index that allows NULL values:

mysql> CREATE TABLE mul_test(
   -> mul_column INT UNSIGNED,
   -> INDEX(mul_column)
   -> );
Query OK, 0 rows affected (0.01 sec)

mysql> DESCRIBE mul_test;
+------------+------------------+------+-----+---------+-------+
| Field      | Type             | Null | Key | Default | Extra |
+------------+------------------+------+-----+---------+-------+
| mul_column | int(10) unsigned | YES  | MUL | NULL    |       |
+------------+------------------+------+-----+---------+-------+
1 row in set (0.00 sec) 

This was first published in November 2004

Dig deeper on Open source databases

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchDataCenter

SearchServerVirtualization

SearchCloudComputing

SearchEnterpriseDesktop

Close