Hi,
I was playing with MySQL (4.1.9) during the weekend, but noticed a minor
problem and would like someone to explain this to me.
Basically I could successfully create a table with one unique column
like this:
mysql> create table t1 (c1 int unique);
Query OK, 0 rows affected (0.08 sec)
What bothers me is that I just don't see how the CREATE TABLE syntax
allows the UNIQUE keyword to appear in a COLUMN_DEFINITI ON:
COLUMN_DEFINITI ON:
COL_NAME TYPE [NOT NULL | NULL] [DEFAULT DEFAULT_VALUE]
[AUTO_INCREMENT] [[PRIMARY] KEY] [COMMENT 'STRING']
[REFERENCE_DEFIN ITION]
The only explanation I can think of is that this way of declaring a
column unique was supported in some old release and the current version
of MySQL is just trying to keep the backwards compatibility (like SERIAL
column data type).
Does anyone know the real reason? Any input will be appreciated!
- Baoqiu
--
Baoqiu Cui <cbaoqiu at yahoo.com>