Problem solve Get help with specific problems with your technologies, process and projects.

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) 

Dig Deeper on Linux servers