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 last 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.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

SearchServerVirtualization

SearchCloudComputing

SearchEnterpriseDesktop

Close